Skip to content

Commit

Permalink
Fix potential bug where someone enters a negative page number into th…
Browse files Browse the repository at this point in the history
…e paginator.
  • Loading branch information
rizen committed Oct 24, 2024
1 parent 9595899 commit 5d9d218
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ving/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ outline: deep
* Updated the redis client to trap bad connection strings with an error message.
* Updated the drizzle client to use dotenv to get the connection string.
* Updated the drizzle client to trap bad connection strings with an error message.
* Fix potential bug where someone enters a negative page number into the paginator.

### 2024-10-01
* Added colin's patch for mysql pagination.
Expand Down
2 changes: 1 addition & 1 deletion ving/record/VingRecord.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export class VingKind {
orderBy = cols;
}
const itemsPerPage = isUndefined(params?.itemsPerPage) || params?.itemsPerPage > 100 || params?.itemsPerPage < 1 ? 10 : params.itemsPerPage;
const page = params.page || 1;
const page = typeof params.page == 'undefined' || params.page < 1 ? 1 : params.page;
const maxItems = params.maxItems || 100000000000;
const itemsUpToThisPage = itemsPerPage * page;
const fullPages = Math.floor(maxItems / itemsPerPage);
Expand Down

0 comments on commit 5d9d218

Please sign in to comment.