Pagy Show archive.org snapshot is a gem for pagination. They make some bold claims:
Pagy is the ultimate pagination gem that outperforms the others in each and every benchmark and comparison.
Our laser focus on a single technology has made us a leader in this space. Need help?
Maybe this is worth trying out.