Fixing search last page button bug.

Review Request #14656 — Created Oct. 27, 2025 and updated — Latest diff uploaded

Information

Review Board
master

Reviewers

The "Last Page" button in search should navigate to the final page of results, but previously it used paginator.num_pages - 1, which fails because Django’s Paginator is 1-indexed, not 0-indexed. This change resolves the issue by using paginator.num_pages directly, ensuring the button correctly goes to the last page.

In test_pagination(), the test originally passed by returning 20 for the last page after creating 20 mock review requests with search_results_per_page set to 1. However, reindex_search() adds an additional page during indexing, resulting in a total of 21 pages. Consequently, the view calculated last_page_num as 20, which did not match the actual last page. To address this, the test was updated to assert the last page based on the paginator’s num_pages property, ensuring it accurately reflects the total number of pages.

Commits

Files