fix(view): strip the emitted first-page prefix in paginationLinks(prependOnFirst=false) - #3666
Merged
bpamiri merged 1 commit intoSep 27, 2026
Conversation
…pendOnFirst=false) paginationLinks() removed Len(arguments.prependToPage) characters from the front of the window when prependOnFirst=false, but the first page is actually prefixed with the sanitized prependToPage (entity-decoded, event handlers stripped) or, when it is the current page and addActiveClassToPrependedParent=true, a variant with "active " injected. Any length difference cut into or left behind part of the markup, e.g. a leading `-item">1</li>`. Extract the per-page prefix into $paginationPrependForPage() so the window loop and the prependOnFirst strip share it, and strip that exact string (only when it matches) instead of the raw argument length, mirroring the appendOnLast branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018RdXpVKos1AZ24dM4X8wL1 Signed-off-by: Claude <noreply@anthropic.com>
bpamiri
deleted the
claude/wheels-framework-bug-review-odsc9d-pagination-prepend
branch
September 27, 2026 02:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With
prependOnFirst=false, legacypaginationLinks()strippedLen(arguments.prependToPage)characters from the start of the page window. But the first page is not preceded by the raw argument. It gets the sanitizedprependToPage(numeric entities decoded,on*handlers stripped), or itsactivevariant when that page is the current one andaddActiveClassToPrependedParent=true. Whenever the lengths differ, the first link is mangled. The siblingappendOnLastbranch already uses the sanitized length.Fix: the per-page prefix logic moves into a new public helper,
$paginationPrependForPage(), which the window loop and the strip now share. The strip works out the first page in the window (Max(1, currentPage - windowSize), matching the loop's lower bound). It then removes that exact prefix, and only ifLeft()actually matches it.Related Issue
None filed. Found during a framework bug review.
Type of Change
Feature Completeness Checklist
view/linksSpec.cfc: the active-class prefix, encode=true markup with numeric entities, and a strippedonclickhandler.changelog.d/pagination-links-prepend-on-first.fixed.mdTest Plan
I extracted
paginationLinks,$paginationWindowMiddle,$paginationAnchorLinkand the real sanitize/decode helpers verbatim and ran them on Lucee 6.2 through JSR-223.linkTo/paginationwere stubbed, andEncodeForHTMLwas replaced with an ESAPI-style encoder. Old → new:<li class="page-item">, active class on, page 1 current, encode=false:-item">1</li>…→1</li><li class="page-item">…<li class='page-item'>, page 2:/a></li>…→<a href="?page=1">1</a>…<li onclick="x()">:=1">1</a></li>…→<a href="?page=1">1</a></li>…<li>, the defaultprependOnFirst, and the active class on a later page produce identical output before and after.🤖 Generated with Claude Code
https://claude.ai/code/session_018RdXpVKos1AZ24dM4X8wL1
Generated by Claude Code