# HG changeset patch # User jbe # Date 1264959395 -3600 # Node ID f02e14d1e69e28d25f7aa9838ab98dec7b2b7080 # Parent f7413a1a872c11857ac01a73107fb17fe3b059b5 Bugfix: Negative offset when paginating empty result set diff -r f7413a1a872c -r f02e14d1e69e framework/env/ui/paginate.lua --- a/framework/env/ui/paginate.lua Sat Jan 30 12:41:37 2010 +0100 +++ b/framework/env/ui/paginate.lua Sun Jan 31 18:36:35 2010 +0100 @@ -23,7 +23,10 @@ count_selector:add_from(selector) count_selector:single_object_mode() local count = count_selector:exec().count - local page_count = math.floor((count - 1) / per_page) + 1 + local page_count = 1 + if count > 0 then + page_count = math.floor((count - 1) / per_page) + 1 + end local current_page = atom.integer:load(cgi.params[name]) or 1 if current_page > page_count then current_page = page_count