mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-30 17:41:53 +00:00
extensions: limit pagination to max num of pages
This commit is contained in:
parent
6608c99b90
commit
db83989d5d
|
@ -27,6 +27,8 @@ def fix_paginate():
|
|||
total_query_count = count_query.scalar()
|
||||
else:
|
||||
total_query_count = self.count()
|
||||
if max_page:
|
||||
total_query_count = min(total_query_count, max_page * per_page)
|
||||
|
||||
# Grab items on current page
|
||||
items = self.limit(per_page).offset((page - 1) * per_page).all()
|
||||
|
|
|
@ -511,7 +511,6 @@ def search_db(term='', user=None, sort='id', order='desc', category='0_0',
|
|||
if len(item) >= 2:
|
||||
qpc.filter(FullTextSearch(
|
||||
item, models.TorrentNameSearch, FullTextMode.NATURAL))
|
||||
|
||||
query, count_query = qpc.items
|
||||
# Sort and order
|
||||
if sort_column.class_ != models.Torrent:
|
||||
|
|
Loading…
Reference in a new issue