Ensured that Paginator.page_range works the same on Python 2 and 3.

This somewhat fixes #23088, refs 23140.