Fix paginate query string parse exception

While working on a new flavour I noticed a nasty exception I got as soon as I added ?flav=html to any URL. Apparently a change in the last commit to paginate.py was the culprit. The attached patch fixes the problem. 

Commit 52376c30da5 introduced a bug which resulted in a nasty exception
if the URL contained a query string without a page keyword.