Server side pagination is intrinsically not accurate, as long as the data is dynamic.
The data items could be inserted, deleted or changed on the server side while the user goes forward and backward among the pages.
However, there is an algorithm that can keep the pagination as stable as possible:
- encode the id and sorting fields of last value in a page as the continue-token
- return the continue-token along with each page
- the client must pass the continue-token to fetch the next page
- the next page starts with value > continue-token || (value == continue-token && value.id > continue-token.id)