pagination improvements, fixes #6542