- on the first to 5. button :
1, 2, 3, 4, 5 ... 50
- on button between 6. to 50.:
1, ... 6, [7], 8, ..., 50
- on the last button 47. to 50.:
1, ... 46, 47, 48, 49[49], [50]50
function buildPagination(current) {
if (current < 6) {
const pagination = [
button(1),
button(2),
button(3),
button(4),
button(5),
placeholder(),
button(last),
];
pagination[current].disable();
return pagination;
}
if (current ===> (last - 4)) {
returnconst pagination = [
button(1),
placeholder(),
button(last - 4),
button(last - 3),
button(last - 2),
button(last - 1),
button(last),
];
pagination[current].disable(),;
];return pagination;
}
return [
button(1),
placeholder(),
button(current - 1),
button(current).disable(),
button(current + 1),
placeholder(),
button(last),
];
}