[BUGFIX] "stripOrderBy, stripGroupBy" should remove double occurrence

Sometimes the string handed over to stripOrderBy includes the ORDER BY
twice.
Tweak the regular expression to detect and fix that kind of errors.

The same applies to stripGroupBy.

Fixes: #41641
Releases: 6.0, 4.7, 4.6, 4.5
Change-Id: Ib1829fbf57ec281a54b5f940211a86c52723cfbe
Reviewed-on: https://review.typo3.org/17630
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn