Pagination of results

how to paginate results from the database, like tiny db? And making the previous and next buttons active and inactive depending on the position of the first and last record?

Use for each number block to separate items from the list.

if you want to separate items then better use for each item in list