extensions: limit pagination to max num of pages

This commit is contained in:
Nicolas F 2019-04-02 18:57:56 +02:00
parent 6608c99b90
commit db83989d5d
2 changed files with 2 additions and 1 deletions

View File

@ -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()

View File

@ -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: