Skip to content

Commit 58b344c

Browse files
committed
zipnum fix: fix pagination for zipnum page size calculation
1 parent 70ce244 commit 58b344c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/org/archive/format/gzip/zipnum/ZipNumIndex.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ public PageResult getNthPage(String[] startEnd, int page, int pageSize, boolean
198198
int endLineNumber = extractLineCount(startEndIdx[1]) + 1;
199199
int totalLines = endLineNumber - firstLineNumber;
200200

201-
int numPages = (totalLines / pageSize) + 1;
201+
int numPages = ((totalLines - 1) / pageSize) + 1;
202+
203+
if (numPages < 1) {
204+
numPages = 1;
205+
}
202206

203207
if (numPagesOnly) {
204208
return new PageResult(null, numPages);

0 commit comments

Comments
 (0)