[5.0] Fix A Few Things For Pagination

Replaces #6054, retaining the original commit authorship.