Your query for information will need to return both count of matching items as well as the current payload of information. Typically what I do for this scenario is to create a generic object that handles the pagination logic:
public class Page<T>
{
public int Total {get;}
public int PageSize {get;set;}
public int PageNum {get;set;}
public bool HasNext {get;}
public bool HasPrevious {get;}
public List<T> Records {get;}
}
Given the current page size and page, and the total number of records that apply to the query, everything else could be calculated. The container class Page<T> handled all the pagination logic, and it could be reused for any type we needed.