[5.0] Fix A Few Things For Pagination

Replaces #6054, retaining the original commit authorship.
Oh my god this has bugged me for so long