-
-
Notifications
You must be signed in to change notification settings - Fork 263
Fix tag search pagination issue causing no results on subsequent pages #3604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@thorsten 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
phpmyfaq/src/phpMyFAQ/Faq.php
Outdated
| * @todo this method needs to be refactored, parts of it should be moved to a Twig template | ||
| */ | ||
| public function renderFaqsByFaqIds(array $faqIds, string $orderBy = 'fd.id', string $sortBy = 'ASC'): array | ||
| public function renderFaqsByFaqIds(array $faqIds, string $orderBy = 'fd.id', string $sortBy = 'ASC', bool $usePagination = true): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line exceeds 120 characters; contains 139 characters, please fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit a2495c8. Broke the long method signature into multiple lines to stay within the 120 character limit.
phpmyfaq/src/phpMyFAQ/Faq.php
Outdated
| $lastFaqId = 0; | ||
| $faqHelper = new FaqHelper($this->configuration); | ||
| while (($row = $this->configuration->getDb()->fetchObject($result)) && $displayedCounter < $numberPerPage) { | ||
| while (($row = $this->configuration->getDb()->fetchObject($result)) && (!$usePagination || $displayedCounter < $numberPerPage)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line exceeds 120 characters; contains 141 characters, please fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit a2495c8. Broke the long while condition into multiple lines to stay within the 120 character limit.
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@copilot please fix the open issues |
…dition Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
phpmyfaq/src/phpMyFAQ/Faq.php
Outdated
| string $orderBy = 'fd.id', | ||
| string $sortBy = 'ASC', | ||
| bool $usePagination = true | ||
| ): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line, please fixt that @copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 28e1c12. The closing parenthesis and opening brace are now on the same line as required by PSR-12 standards.
…as closing parenthesis Co-authored-by: thorsten <45284+thorsten@users.noreply.github.com>
After updating to phpMyFAQ 4.0.10, tag search functionality was broken - searches would show no results on any page, including the first page in some cases. The issue was caused by conflicting pagination logic between the search controller and the FAQ rendering method.
Root Cause
The
renderFaqsByFaqIdsmethod inFaq.phpimplements its own internal pagination logic that skips records based on the current page number. However, the tag search insearch.phpwas also setting up pagination independently, creating a mismatch:renderFaqsByFaqIdswith all IDsrenderFaqsByFaqIdsapplies its own pagination, skipping records for page 2+Solution
This PR coordinates the two pagination systems by:
$usePaginationparameter torenderFaqsByFaqIds(defaults totruefor backward compatibility)Example
Before the fix, with 15 tag search results and 10 records per page:
After the fix:
Changes
search.php: Added proper pagination logic for tag searches (7 lines added, 1 removed)Faq.php: Added optional pagination control parameter (5 lines added, 4 modified)The changes are minimal and maintain full backward compatibility with existing code.
Fixes #3579.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/2tvenom/CBOREncode/zipball/42aedccb861d01fc0554782348cc08f8ebf22332/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/Bacon/BaconQrCode/zipball/f9cc1f52b5a463062251d666761178dbdb6b544f/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90/usr/bin/php8.3 -n -c /tmp/nqPerO /usr/bin/composer install --no-dev(http block)/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/elastic/elastic-transport-php/zipball/1d476af5dc0b74530d59b67d5dd96ee39768d5a4/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/elastic/elasticsearch-php/zipball/1771284cb43a7b653634d418b6f5f0ec84ff8a6d/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/endroid/qr-code/zipball/21e888e8597440b2205e2e5c484b6c8e556bcd1a/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/ezimuel/guzzlestreams/zipball/903161be81e9f497cc42fb7db982404a4e6441b0/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/ezimuel/ringphp/zipball/bc983599ec7add50c00e420e867c403c8ed16ae7/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/nette/utils/zipball/c930ca4e3cf4f17dcfb03037703679d2396d2ede/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/opensearch-project/opensearch-php/zipball/97e942dfac44d40d3db5b3c4a8656fe0d1e22294/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/opentelemetry-php/api/zipball/b3a9286f9c1c8247c83493c5b1fa475cd0cec7f7/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/opentelemetry-php/context/zipball/438f71812242db3f196fb4c717c6f92cbc819be6/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90/usr/bin/php8.3 -n -c /tmp/nqPerO /usr/bin/composer install --no-dev(http block)/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94f8051919d1b0369a6bcc7931d679a511c03fe9/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpseclib/phpseclib/zipball/56483a7de62a6c2a6635e42e93b8a9e25d4f0ec6/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b9e61a61e39e02dd90944e9115241c7f7e76bfd8/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/http-client/zipball/1c064a0c67749923483216b081066642751cc2c7/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/symfony/yaml/zipball/b8d7d868da9eb0919e99c8830431ea087d6aae30/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/thephpleague/commonmark/zipball/10732241927d3971d28e7ea7b5712721fa2296ca/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991/usr/bin/php8.3 -n -c /tmp/s1HTMO /usr/bin/composer install --dev --no-interaction(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.