Fix the "Last" page link in the search results.

Review Request #2189 — Created July 16, 2021 and submitted — Latest diff uploaded

Review Board
Haystack removed a template context variable we used to grab the last
page number, for the "Last" page link in the paginator. This change
fixes that anchor.

It also fixes up the view code to use the modern version of `range()`,
to ensure consistency across Python 2.7 and 3.x.

Unit tests were added to ensure this doesn't regress in the future.

Testing Done:
Verified that search results render and include all the right links
on Python 2.x and 3.x.

Unit tests passed.

Reviewed at