--- a/views/pages.tpl
+++ b/views/pages.tpl
@@ -1,16 +1,24 @@
+%import sys
+%py3k = sys.version_info >= (3, 0, 0)
+%if py3k:
+ %from urllib.parse import urlencode
+%else:
+ %from urllib.parse import urlencode
+%end
+%import math
+
%q = dict(query)
%def page_href(page):
%q['page'] = page
- %return './results?%s' % urllib.urlencode(q)
+ %return './results?%s' % urlencode(q)
%end
%if nres > 0:
- %import math, urllib
%npages = int(math.ceil(nres/float(config['perpage'])))
%if npages > 1:
<div id="pages">
<a title="First" class="page" href="{{page_href(1)}}">«</a>
<a title="Previous" class="page" href="{{page_href(max(1,query['page']-1))}}">‹</a>
- %offset = ((query['page'])/10)*10
+ %offset = ((query['page'])//10)*10
%for p in range(max(1,offset), min(offset+10,npages+1)):
%if p == query['page']:
%cls = "page current"