The title is just an example. When there is a list of products and they are displayed on the pages, it is natural to choose everything, and then it seems to me very inefficient to deal with the pages in the code. The question is not how to do it there, but how to do it beautifully and optimally. The cursor is probably bad? Same on one line for request to pull - it is bad?
On the other hand, you need to know the total number of lines to determine the number of pages. But when the user goes through the pages, again make a request ... What can I do?