Javascript Simple Pagination
function pagenation(current, total){
var list = [];
var pageLimit = 9;
var upperLimit, lowerLimit;
var currentPage = lowerLimit = upperLimit = Math.min(current, total);
for (var b = 1; b < pageLimit && b < total;) {
if (lowerLimit > 1 ) {
lowerLimit--; b++;
}
if (b < pageLimit && upperLimit < total) {
upperLimit++; b++;
}
}
if(lowerLimit!==1){
list.push(1);
}
for (var i = lowerLimit; i < upperLimit; i++) {
if (i == currentPage){
list.push("["+i+"]");
}
else{
list.push(i);
}
}
list.push(total);
console.log(list);
return list;
}