if (!isset($_SESSION['AIPagesVisitedStack']))
{
			$_SESSION['AIPagesVisitedStack'] = array();
}

if (!isset($_SESSION['AIQuickLinksDetails']))
{
			$_SESSION['AIQuickLinksDetails'] = array();
}

if ($_SERVER['REDIRECT_URL'] != '/notfound.html')
{

		$AIPagesVisitedStack = $_SESSION['AIPagesVisitedStack']; 
		$AIQuickLinksDetails = $_SESSION['AIQuickLinksDetails'];
		
		//get the current visited URL
		$AIPathParts = parse_url($_SERVER['REQUEST_URI']);
		
		//we search to see if the path is in the list of favourite links list
		$q = "SELECT Collection_393.* , Collection_396.* FROM Collection_393 INNER JOIN Collection_396 ON Collection_396_1 = Collection_393_ID WHERE '".addslashes($_SERVER['REQUEST_URI'])."' REGEXP Collection_393_1 = 1 Order By Collection_396_4 ";
		$res = $db->query($q);
				
		if ($res->numRows() > 0)
		{
				
				//push the url visited
				array_unshift($AIPagesVisitedStack , $AIPathParts['path']);
				
				$AIPagesVisitedStack = array_unique($AIPagesVisitedStack);
		
				if (count($AIPagesVisitedStack) > 5)
				{
						array_pop($AIPagesVisitedStack);
				}
				
				
				$AIQuickLinksDetails[$AIPathParts['path']] = $db->queryAll($q);
			
				
		}		
		
		
		//publish the data
		$_SESSION['AIPagesVisitedStack'] = $AIPagesVisitedStack;
		$_SESSION['AIQuickLinksDetails'] = $AIQuickLinksDetails;
				
		
}		