~fabrixxm/lesanaweb

272be3c62a410bb7aadcf33184ef357d8715641c — fabrixxm 1 year, 1 month ago 1cc9593
Check page parameter range
1 files changed, 4 insertions(+), 0 deletions(-)

M app.py
M app.py => app.py +4 -0
@@ 48,6 48,8 @@ app.jinja_loader = my_loader
def search():
    page = int(request.args.get('p', 1))
    q = request.args.get('q', ' ')
    if (page < 1):
        page = 1

    collection.start_search(q)
    entries = list(collection.get_search_results(page - 1, PAGESIZE))


@@ 72,6 74,8 @@ def entry(eid):
def index():
    pagestart = 0
    page = int(request.args.get('p', 1))
    if (page < 1):
        page = 1
    pagestart = (page - 1) * PAGESIZE
    pageend = pagestart + PAGESIZE