[5.0] Fix isEmpty() Bug With Paginator

This fixes #6284.

Two PRs attempted to fix this (#6266, #6353) but we both made the same mistake. I (embarassingly) didn't bother to check why the tests failed.

Line 352 was changed for consistency.