Index: t3lib/class.t3lib_tstemplate.php
===================================================================
--- t3lib/class.t3lib_tstemplate.php	(Revision 2046)
+++ t3lib/class.t3lib_tstemplate.php	(Arbeitskopie)
@@ -1374,14 +1374,9 @@
 		$LD['no_cache'] = (trim($page['no_cache']) || $no_cache) ? '&no_cache=1' : '';
 
 			// linkVars
+		$LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;			
 		if ($GLOBALS['TSFE']->config['config']['uniqueLinkVars']) {
-			if ($addParams) {
-				$LD['linkVars'] = t3lib_div::implodeArrayForUrl('',t3lib_div::explodeUrl2Array($GLOBALS['TSFE']->linkVars.$addParams));
-			} else {
-				$LD['linkVars'] = $GLOBALS['TSFE']->linkVars;
-			}
-		} else {
-			$LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;
+			$LD['linkVars'] = t3lib_div::implodeArrayForUrl('',t3lib_div::explodeUrl2Array($LD['linkVars']));
 		}
 
 			// If simulateStaticDocuments is enabled:
Index: typo3/sysext/cms/tslib/class.tslib_pagegen.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_pagegen.php	(Revision 2046)
+++ typo3/sysext/cms/tslib/class.tslib_pagegen.php	(Arbeitskopie)
@@ -197,40 +197,57 @@
 		$linkVars = (string)$GLOBALS['TSFE']->config['config']['linkVars'];
 		if ($linkVars)	{
 			$linkVarArr = explode(',',$linkVars);
+			$linkVars = '';
 
-			$GLOBALS['TSFE']->linkVars='';
 			$GET = t3lib_div::_GET();
 
-			foreach ($linkVarArr as $val)	{
-				$val = trim($val);
+			foreach ($linkVarArr as $var)	{
+				$var = trim($var);
 
-				if (preg_match('/^(.*)\((.+)\)$/',$val,$match))	{
-					$val = trim($match[1]);
+				if (preg_match('/^(.*)\((.+)\)$/',$var,$match))	{
+					$var = trim($match[1]);
 					$test = trim($match[2]);
 				} else unset($test);
 
-				if ($val && isset($GET[$val]))	{
-					if (!is_array($GET[$val]))	{
-						$tmpVal = rawurlencode($GET[$val]);
+				if ($var && isset($GET[$var]))	{
+					if (!is_array($GET[$var]))	{
+						$tmpVar = rawurlencode($GET[$var]);
 
-						if ($test && !TSpagegen::isAllowedLinkVarValue($tmpVal,$test))	{
+						if ($var=='cHash') {
+								// Reusing cHash will not work - if set, remove it here and recreate it later if necessary.
+							if (isset($tmpVar)) {
+								$createCHash = true;
+							}
+							continue;
+						} elseif ($test && !TSpagegen::isAllowedLinkVarValue($tmpVar,$test))	{
 							continue;	// Error: This value was not allowed for this key
 						}
 
-						$value = '&'.$val.'='.$tmpVal;
+						$value = '&'.$var.'='.$tmpVar;
 					} else {
 						if ($test && strcmp('array',$test))	{
 							continue;	// Error: This key must not be an array!
 						}
-						$value = t3lib_div::implodeArrayForUrl($val,$GET[$val]);
+						$value = t3lib_div::implodeArrayForUrl($var,$GET[$var]);
 					}
 				} else continue;
 
-				$GLOBALS['TSFE']->linkVars.= $value;
+					// Readd the current variable to the linkVars:
+				$linkVars .= $value;
 			}
 			unset($GET);
+
+				// Recreate cHash if necessary:
+			if ($linkVars && $createCHash) {
+					// Get the array with query params, one key is the encryptionKey by default:
+				$pA = t3lib_div::cHashParams($linkVars);
+				if (count($pA) > 1) {
+					$linkVars .= '&cHash='.t3lib_div::shortMD5(serialize($pA));
+				}
+			}
+			$GLOBALS['TSFE']->linkVars = $linkVars;
 		} else {
-			$GLOBALS['TSFE']->linkVars='';
+			$GLOBALS['TSFE']->linkVars = '';
 		}
 
 			// Setting XHTML-doctype from doctype
Index: typo3/sysext/cms/tslib/class.tslib_content.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_content.php	(Revision 2046)
+++ typo3/sysext/cms/tslib/class.tslib_content.php	(Arbeitskopie)
@@ -5199,7 +5199,7 @@
 						if (substr($addQueryParams,0,1)!='&')		{
 							$addQueryParams = '';
 						} elseif ($conf['useCacheHash']) {	// cache hashing:
-							$pA = t3lib_div::cHashParams($addQueryParams.$GLOBALS['TSFE']->linkVars);	// Added '.$this->linkVars' dec 2003: The need for adding the linkVars is that they will be included in the link, but not the cHash. Thus the linkVars will always be the problem that prevents the cHash from working. I cannot see what negative implications in terms of incompatibilities this could bring, but for now I hope there are none. So here we go... (- kasper)
+							$pA = t3lib_div::cHashParams($GLOBALS['TSFE']->linkVars.$addQueryParams);	// Added '.$this->linkVars' dec 2003: The need for adding the linkVars is that they will be included in the link, but not the cHash. Thus the linkVars will always be the problem that prevents the cHash from working. I cannot see what negative implications in terms of incompatibilities this could bring, but for now I hope there are none. So here we go... (- kasper)
 							$addQueryParams.= '&cHash='.t3lib_div::shortMD5(serialize($pA));
 						}
 
