There are a lot of things you can do on bubble with custom states. Custom states have been something for me that opened up a whole new level of abilities on Bubble. I believe this link may be of some help
It provides some ideas of how to create a really good pagination effect. Main idea is to set data source to show items from until and utilize the custom states to represent the numbers from and until.
Then need to add some more custom states to do the math involved to always have the correct number of items shown on each page. As you get to the last page you will be left with the final items displayed.
Your real issue I assume is in the numbers list for pagination…this also may require some custom states to set those up the correct way.
You can do some fancy work on the pagination to automatically change as well using some workflows to scroll to the page number you are looking for.
Another nice feature is the “current cell’s index” which is basically a number ( like a sort number )…utilizing that in your pagination can keep things together as well.