Quellcode durchsuchen

Shared queries: keep user search in HTML pagination (#9545)

Fix the paging bug noticed in #9544.

In the HTML view of a shared user query, the pagination links did not include the `search` parameter, so the user search was lost when going to the next page.

The pagination links now keep the user search (URL-encoded). The common part of the URLs is factored out, using `&` consistently.

Tested locally with a shared query of 60 entries and `search=x`: the second page now only shows matching entries.
Mehmet vor 6 Stunden
Ursprung
Commit
27c2b18822
1 geänderte Dateien mit 8 neuen und 5 gelöschten Zeilen
  1. 8 5
      app/views/helpers/htmlPagination.phtml

+ 8 - 5
app/views/helpers/htmlPagination.phtml

@@ -1,21 +1,24 @@
 <?php
 	declare(strict_types=1);
 	/** @var FreshRSS_View $this */
+	$url = $this->userQuery->sharedUrlHtml() . '&amp;nb=' . FreshRSS_Context::$number;
+	$search = FreshRSS_Context::$search->toString();
+	if ($search !== '') {
+		$url .= '&amp;search=' . rawurlencode($search);
+	}
 ?>
 <nav class="nav-pagination nav-list">
 	<ul class="pagination">
 		<?php if (FreshRSS_Context::$offset > 0): ?>
 		<li class="item pager-first">
-			<a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number ?>">« <?= _t('conf.logs.pagination.first') ?></a>
+			<a href="<?= $url ?>">« <?= _t('conf.logs.pagination.first') ?></a>
 		</li>
 		<li class="item pager-previous">
-			<a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number .
-				'&offset=' . max(0, FreshRSS_Context::$offset - FreshRSS_Context::$number) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a>
+			<a href="<?= $url . '&amp;offset=' . max(0, FreshRSS_Context::$offset - FreshRSS_Context::$number) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a>
 		</li>
 		<?php endif; ?>
 		<li class="item pager-next">
-			<a href="<?= $this->userQuery->sharedUrlHtml() . '&nb=' . FreshRSS_Context::$number .
-				'&offset=' . (FreshRSS_Context::$offset + FreshRSS_Context::$number) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a>
+			<a href="<?= $url . '&amp;offset=' . (FreshRSS_Context::$offset + FreshRSS_Context::$number) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a>
 		</li>
 	</ul>
 </nav>