I think, the pagination widget is written not quite correctly.
The pagination widget uses the widget LinkViewHelper, that has the method getWidgetUri
protected function getWidgetUri()
{
$uriBuilder = $this->controllerContext->getUriBuilder();
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
if ($this->hasArgument('action')) {
$arguments['action'] = $this->arguments['action'];
}
if ($this->hasArgument('format') && $this->arguments['format'] !== '') {
$arguments['format'] = $this->arguments['format'];
}
return $uriBuilder->reset()
->setArguments([$argumentPrefix => $arguments])
->setSection($this->arguments['section'])
->setAddQueryString(true)
->setAddQueryStringMethod($this->arguments['addQueryStringMethod'])
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash'])
->setFormat($this->arguments['format'])
->build();
}
setAddQueryString(true) says to add all get-parameter to each pagination URL
And it's not possible to set addQueryString to false, or to say, that only certain parameters have to be added. In my case, these are startdate and enddate
I resolved this problem using xclass, and getWidgetUri looks like this:
protected function getWidgetUri()
{
$uriBuilder = $this->controllerContext->getUriBuilder();
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
if ($this->hasArgument('action')) {
$arguments['action'] = $this->arguments['action'];
}
if ($this->hasArgument('format') && $this->arguments['format'] !== '') {
$arguments['format'] = $this->arguments['format'];
}
$startdate = GeneralUtility::_GET('startdate');
$enddate = GeneralUtility::_GET('enddate');
$allowedParams = array();
if ($startdate != NULL) {
$allowedParams['startdate'] = $startdate;
}
if ($enddate != NULL) {
$allowedParams['enddate'] = $enddate;
}
return $uriBuilder->reset()
->setArguments([$argumentPrefix => $arguments, $allowedParams])
->setSection($this->arguments['section'])
->setAddQueryString(false)
->setAddQueryStringMethod($this->arguments['addQueryStringMethod'])
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash', 'type'])
->setFormat($this->arguments['format'])
->setUseCacheHash(false)
->build();
}