From 64097c5ebcb86c58acd69ea50bdd0d3af6a8d52b Mon Sep 17 00:00:00 2001
From: Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
Date: Fri, 12 Jan 2024 16:42:49 +0100
Subject: [PATCH] [BUGFIX] Fix filter persistence across pagination

---
 .../Private/Templates/PageBrowser/Index.html  | 27 +++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/Resources/Private/Templates/PageBrowser/Index.html b/Resources/Private/Templates/PageBrowser/Index.html
index 781f977a..cf03df71 100644
--- a/Resources/Private/Templates/PageBrowser/Index.html
+++ b/Resources/Private/Templates/PageBrowser/Index.html
@@ -12,14 +12,15 @@
 							<f:variable name="prevPage" value="{currentPage - 1}"/>
 							<f:if condition="{prevPage} == 0">
 								<f:then>
-									<f:link.action addQueryString="1"
-												   additionalParams="{tx_sgjobs_pagebrowser: ''}"
+									<f:link.action addQueryString="untrusted"
+												   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 												   additionalAttributes="{aria-label: 'Previous'}">
 										&laquo;
 									</f:link.action>
 								</f:then>
 								<f:else>
-									<f:link.action addQueryString="1"
+									<f:link.action addQueryString="untrusted"
+												   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 												   additionalParams="{tx_sgjobs_pagebrowser: {currentPage: prevPage}}"
 												   additionalAttributes="{aria-label: 'Previous'}">
 										&laquo;
@@ -44,13 +45,14 @@
 						<f:variable name="lessPage" value="{currentPage - 2}"/>
 						<f:if condition="{lessPage} == 0">
 							<f:then>
-								<f:link.action addQueryString="1"
-											   additionalParams="{tx_sgjobs_pagebrowser: ''}">
+								<f:link.action addQueryString="untrusted"
+											   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}">
 									...
 								</f:link.action>
 							</f:then>
 							<f:else>
-								<f:link.action addQueryString="1"
+								<f:link.action addQueryString="untrusted"
+											   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 											   additionalParams="{tx_sgjobs_pagebrowser: {currentPage: lessPage}}">
 									...
 								</f:link.action>
@@ -75,13 +77,14 @@
 							<li class="tx-pagebrowse-page">
 								<f:if condition="{pageLink.page} == 0">
 									<f:then>
-										<f:link.action addQueryString="1"
-													   additionalParams="{tx_sgjobs_pagebrowser: ''}">
+										<f:link.action addQueryString="untrusted"
+													   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}">
 											{pageLink.number}
 										</f:link.action>
 									</f:then>
 									<f:else>
-										<f:link.action addQueryString="1"
+										<f:link.action addQueryString="untrusted"
+													   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 													   additionalParams="{tx_sgjobs_pagebrowser: {currentPage: pageLink.page}}">
 											{pageLink.number}
 										</f:link.action>
@@ -95,7 +98,8 @@
 				<f:if condition="{enableMorePages} && {showNextPages}">
 					<li>
 						<f:variable name="morePage" value="{currentPage + 2}"/>
-						<f:link.action addQueryString="1"
+						<f:link.action addQueryString="untrusted"
+									   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 									   additionalParams="{tx_sgjobs_pagebrowser: {currentPage: morePage}}">
 							...
 						</f:link.action>
@@ -106,7 +110,8 @@
 					<f:then>
 						<li class="tx-pagebrowse-next">
 							<f:variable name="nextPage" value="{currentPage + 1}"/>
-							<f:link.action addQueryString="1"
+							<f:link.action addQueryString="untrusted"
+										   argumentsToBeExcludedFromQueryString="{0: 'tx_sgjobs_pagebrowser'}"
 										   additionalParams="{tx_sgjobs_pagebrowser: {currentPage: nextPage}}"
 										   additionalAttributes="{aria-label: 'Next'}">
 								&raquo;
-- 
GitLab