Fix search result pagination link handling
authorMaciek Sakrejda <m.sakrejda@gmail.com>
Mon, 23 Nov 2020 14:37:10 +0000 (15:37 +0100)
committerMagnus Hagander <magnus@hagander.net>
Mon, 23 Nov 2020 14:37:10 +0000 (15:37 +0100)
commit45926dd9c27e5c42acf6f2da1d78fb63d03e91a0
tree331e8978a3450718524bf7773b5783cd2601a4ef
parentc2d58d6f78dc9df8569093d477ec00d1cc8960ab
Fix search result pagination link handling

If the total number of search results is divisible by the page size, the page count
is mis-calculated and there's a link to an additional page of results, even though there
are no more results and that page is empty.

See issue here: https://www.postgresql.org/search/?m=1&q=contrib&l=76&d=365&s=r&p=2

At the moment, this has 20 results but a link to a second page, which is empty with a label of
"Results 21-20 of 20." Previous and Next works still work fine, but that second page
does not really need to be there.

This changes the page count calculation to avoid this issue.
pgweb/search/views.py