refactors paginateRequest().