Skip to content

fix(frontend): clamp page URL param to valid range#758

Open
mathewsap45 wants to merge 1 commit into
Haroldwonder:mainfrom
mathewsap45:fix/660-url-param-upper-bound
Open

fix(frontend): clamp page URL param to valid range#758
mathewsap45 wants to merge 1 commit into
Haroldwonder:mainfrom
mathewsap45:fix/660-url-param-upper-bound

Conversation

@mathewsap45
Copy link
Copy Markdown

Summary

Closes #660

Adds an upper bound check to getPageFromSearchParams in frontend/src/components/TransactionHistory.tsx and clamps the page in handlePageChange.

Problem

?page=999999999 would be parsed and used as-is, requesting a non-existent page with no clamping.

Fix

  • getPageFromSearchParams(params, maxPage) now accepts an optional maxPage argument (defaults to Number.MAX_SAFE_INTEGER) and returns Math.min(parsedPage, maxPage)
  • handlePageChange clamps newPage to [1, totalPages] before applying it

getPageFromSearchParams now accepts a maxPage argument and clamps the
parsed value to [1, maxPage], preventing ?page=999999999 from requesting
a non-existent page. handlePageChange also clamps to totalPages.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@mathewsap45 is attempting to deploy a commit to the Harold's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@mathewsap45 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TransactionHistory.tsx URL search params not sanitized before use

1 participant