A few weeks ago while building a simple node.js app, I had to display a really long list of items.
Pagination had to come in at some point. Since I was using Bootstrap, I had to use its pagination template.
However, manipulating it directly wasn’t so straightforward. Below is my implementation which you can
use by simply copying, pasting and switching key variables.
recordsPerPage = maximum number of records displayed per page
count = total number of records
base_url = the base URL
pageButtonCount = the number of page buttons to show (3 in my case [1] [2] [3])
pageUrl = link to each page. It is formed from the base url and the page number of the page in question eg. base_url + "?count=1&page=" + paginationNo