Fix pagination link handling in search results

From: Maciek Sakrejda <maciek(at)pganalyze(dot)com>
To: pgsql-www(at)lists(dot)postgresql(dot)org
Subject: Fix pagination link handling in search results
Date: 2020-11-16 22:55:37
Message-ID: CADXhmgTxUxyiHbeRoD4ry+S2-M-kTEuw3o4WQUAsyzL2V1pKkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

Hi!

Thanks for maintaining pgweb.

I noticed this issue when searching mailing lists. I did not test the
change in the application, but I did test the logic in a local python
console and I think it's right.

Commit message of the attached commit follows, explaining the issue:

Fix 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.

Attachment Content-Type Size
fix-pagination-link-handling.patch text/x-patch 1.7 KB

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Jonathan S. Katz 2020-11-18 02:24:14 Re: Fix pagination link handling in search results
Previous Message Tom Lane 2020-11-13 14:58:21 Re: Documentation building broken in CFBot