La pagination montre toujours 5 pages

function pageRange(page,pageCount){

var start = page-2,
    end = page+2;

if(end>pageCount){
    start-=(end-pageCount);
    end=pageCount;
}
if(start<=0){
    end+=((start-1)*(-1));
    start=1;
}

end = end>pageCount?pageCount:end;

return {start:start, end:end};
}
DevPedrada