Author Topic: Server error everytime gets pq_curpage=0  (Read 1704 times)

mewbie

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
Server error everytime gets pq_curpage=0
« on: January 13, 2018, 09:33:04 pm »
Hello Paramvir,

When I'm doing filter/sorting query to the request URL, unintentionally sometimes pq_curpage value becomes 0 and returning server error. But when I manually override the URL and change pq_curpage to 1, server behaves normally.

This happens when query result returns zero then click on "reset filter" button.

How can I prevent this? is this a bug?

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Server error everytime gets pq_curpage=0
« Reply #1 on: January 15, 2018, 12:18:06 pm »
pq_curpage is mapped to pageModel.curPage so it may be send as 0 if pageModel.curPage is set to 0 somewhere in your code.

It's better to put a sanity check in server side script.

like if pq_curpage < 1, then set it to 1.

if pq_curpage is > total number of pages, then set it to last page.