mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Also fixed pagination for negative offsets (refs #54)
This commit is contained in:
parent
e962fde32e
commit
1fe77fdaa4
1 changed files with 8 additions and 4 deletions
|
@ -22,10 +22,14 @@ function pagination.calculate(count, limit, offset)
|
||||||
offset = offset or 0
|
offset = offset or 0
|
||||||
|
|
||||||
if offset < 0 then
|
if offset < 0 then
|
||||||
|
if count < math.abs(offset) then
|
||||||
|
limit = count
|
||||||
|
offset = 0
|
||||||
|
else
|
||||||
|
limit = math.min(math.abs(offset), 30)
|
||||||
offset = count + offset
|
offset = count + offset
|
||||||
end
|
end
|
||||||
|
elseif limit + offset > count then
|
||||||
if limit + offset > count then
|
|
||||||
limit = count % limit
|
limit = count % limit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue