webmcp

changeset 8:f02e14d1e69e

Bugfix: Negative offset when paginating empty result set
author jbe
date Sun Jan 31 18:36:35 2010 +0100 (2010-01-31)
parents f7413a1a872c
children 64f4540ce88c
files framework/env/ui/paginate.lua
line diff
     1.1 --- a/framework/env/ui/paginate.lua	Sat Jan 30 12:41:37 2010 +0100
     1.2 +++ b/framework/env/ui/paginate.lua	Sun Jan 31 18:36:35 2010 +0100
     1.3 @@ -23,7 +23,10 @@
     1.4    count_selector:add_from(selector)
     1.5    count_selector:single_object_mode()
     1.6    local count = count_selector:exec().count
     1.7 -  local page_count = math.floor((count - 1) / per_page) + 1
     1.8 +  local page_count = 1
     1.9 +  if count > 0 then
    1.10 +    page_count = math.floor((count - 1) / per_page) + 1
    1.11 +  end
    1.12    local current_page = atom.integer:load(cgi.params[name]) or 1
    1.13    if current_page > page_count then
    1.14      current_page = page_count

Impressum / About Us