diff -ur mediawiki-1.2.2.bak/includes/GlobalFunctions.php mediawiki-1.2.2/includes/GlobalFunctions.php
--- mediawiki-1.2.2.bak/includes/GlobalFunctions.php	2004-03-28 02:06:22.000000000 +0100
+++ mediawiki-1.2.2/includes/GlobalFunctions.php	2004-03-31 13:36:45.000000000 +0100
@@ -334,7 +334,11 @@
 	$wgOut->setRobotpolicy( "noindex,follow" );
 
 	$par = NULL;
-	list($t, $par) = split( "/", $wgTitle->getDBkey(), 2 );
+	$t = $wgTitle->getDBkey();
+	if ( strchr($t, "/") != FALSE ) {
+		list($t, $par) = split( "/", $wgTitle->getDBkey(), 2 );
+	}
+
 
 	if ( array_key_exists( $t, $validSP ) ||
 	  ( $wgUser->isSysop() && array_key_exists( $t, $sysopSP ) ) ||
@@ -647,7 +651,7 @@
 function wfCheckLimits( $deflimit = 50, $optionname = "rclimit" ) {
 	global $wgUser;
 	
-	$limit = (int)$_REQUEST['limit'];
+	$limit = ( isset ( $_REQUEST['limit'] ) ? (int)$_REQUEST['limit'] : 0 );
 	if( $limit < 0 ) $limit = 0;
 	if( ( $limit == 0 ) && ( $optionname != "" ) ) {
 		$limit = (int)$wgUser->getOption( $optionname );
@@ -655,7 +659,7 @@
 	if( $limit <= 0 ) $limit = $deflimit;
 	if( $limit > 5000 ) $limit = 5000; # We have *some* limits...
 	
-	$offset = (int)$_REQUEST['offset'];
+	$offset = ( isset ( $_REQUEST['offset'] ) ? (int)$_REQUEST['offset'] : 0 );
 	$offset = (int)$offset;
 	if( $offset < 0 ) $offset = 0;
 	if( $offset > 65000 ) $offset = 65000; # do we need a max? what?
diff -ur mediawiki-1.2.2.bak/includes/MessageCache.php mediawiki-1.2.2/includes/MessageCache.php
--- mediawiki-1.2.2.bak/includes/MessageCache.php	2004-03-01 05:47:04.000000000 +0000
+++ mediawiki-1.2.2/includes/MessageCache.php	2004-03-31 13:36:45.000000000 +0100
@@ -153,6 +153,8 @@
 	
 	function get( $key, $useDB ) {
 		global $wgLang, $wgLanguageCode;
+
+		$fname  = "MessageCache::get";
 		
 		# If uninitialised, someone is trying to call this halfway through Setup.php
 		if ( !$this->mInitialised ) {
diff -ur mediawiki-1.2.2.bak/includes/Parser.php mediawiki-1.2.2/includes/Parser.php
--- mediawiki-1.2.2.bak/includes/Parser.php	2004-02-28 05:55:13.000000000 +0000
+++ mediawiki-1.2.2/includes/Parser.php	2004-03-31 13:36:45.000000000 +0100
@@ -11,6 +11,7 @@
 class Parser
 {
 	var $mOutput, $mAutonumber, $mLastSection, $mDTopen;
+	var $mContainsNewMagic, $mContainsOldMagic;
 	
 	function Parser()
 	{
@@ -1042,29 +1043,44 @@
 		# headline counter
 		$c=0;
 
+		# Initialise TOC variables
+		$toc="";
+		$toclevel="";
+
+		# Stops the system complaining
+		$h=array ();
+		$head=array ();
+
+		# We should never had a level -1, right?
+		$level=-1;
+
 		# Ugh .. the TOC should have neat indentation levels which can be
 		# passed to the skin functions. These are determined here
 		foreach($matches[3] as $headline) {
-			if($level) { $prevlevel=$level;}
-			$level=$matches[1][$c];
-			if(($nh||$st) && $prevlevel && $level>$prevlevel) { 
-							
-				$h[$level]=0; // reset when we enter a new level				
-				$toc.=$sk->tocIndent($level-$prevlevel);
-				$toclevel+=$level-$prevlevel;
-			
-			} 
-			if(($nh||$st) && $level<$prevlevel) {
-				$h[$level+1]=0; // reset when we step back a level
-				$toc.=$sk->tocUnindent($prevlevel-$level);
-				$toclevel-=$prevlevel-$level;
+			$prevlevel=$level;
 
+			$level=$matches[1][$c];
+			if($nh||$st) {
+				if($level>$prevlevel) { 
+					$h[$level]=0; // reset when we enter a new level				
+					$toc.=$sk->tocIndent($level-$prevlevel);
+					$toclevel+=$level-$prevlevel;
+				} 
+				if($level<$prevlevel) {
+					$h[$level+1]=0; // reset when we step back a level
+					$toc.=$sk->tocUnindent($prevlevel-$level);
+					$toclevel-=$prevlevel-$level;
+				}
+			}
+			if (isset ($h[$level])) {
+				$h[$level]++; // count number of headlines for each level
+			} else {
+				$h[$level] = 1;
 			}
-			$h[$level]++; // count number of headlines for each level
 			
 			if($nh||$st) {
 				for($i=1;$i<=$level;$i++) {
-					if($h[$i]) {
+					if(isset ($h[$i])) {
 						if($dot) {$numbering.=".";}
 						$numbering.=$h[$i];
 						$dot=1;					
@@ -1133,6 +1149,7 @@
 		
 		$blocks=preg_split("/<H[1-6].*?>.*?<\/H[1-6]>/i",$text);
 		$i=0;
+		$full="";
 
 		foreach($blocks as $block) {
 			if(($es) && !isset($wpPreview) && $c>0 && $i==0) {
@@ -1146,7 +1163,7 @@
 				$full="<a name=\"top\"></a>".$full.$toc;
 			}
 
-			$full.=$head[$i];
+			if(isset($head[$i])) $full.=$head[$i];
 			$i++;
 		}
 		
diff -ur mediawiki-1.2.2.bak/includes/Setup.php mediawiki-1.2.2/includes/Setup.php
--- mediawiki-1.2.2.bak/includes/Setup.php	2004-03-29 02:32:32.000000000 +0100
+++ mediawiki-1.2.2/includes/Setup.php	2004-03-31 13:36:45.000000000 +0100
@@ -69,14 +69,14 @@
 # Useful debug output
 if ( function_exists( "getallheaders" ) ) {
 	wfDebug( "\nStart request\n" );
-	wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
+	wfDebug( "{$_SERVER['REQUEST_METHOD']} {$_SERVER['REQUEST_URI']}\n" );
 	$headers = getallheaders();
 	foreach ($headers as $name => $value) {
 		wfDebug( "$name: $value\n" );
 	}
 	wfDebug( "\n" );
 } else {
-	wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" );
+	wfDebug( "{$_SERVER['REQUEST_METHOD']} {$_SERVER['REQUEST_URI']}\n" );
 }
 
 
diff -ur mediawiki-1.2.2.bak/includes/SpecialRecentchanges.php mediawiki-1.2.2/includes/SpecialRecentchanges.php
--- mediawiki-1.2.2.bak/includes/SpecialRecentchanges.php	2004-02-18 02:14:56.000000000 +0000
+++ mediawiki-1.2.2/includes/SpecialRecentchanges.php	2004-03-31 13:36:45.000000000 +0100
@@ -127,7 +127,7 @@
 
 		if ( ! ( $hideminor && $obj->rc_minor ) ) {
 			$rc = RecentChange::newFromRow( $obj );
-			$s .= $sk->recentChangesLine( $rc, $obj->wl_user );
+			$s .= $sk->recentChangesLine( $rc, ( isset( $obj->wl_user ) ? $obj->wl_user : "" ) );
 			--$limit;
 		}
 	}
diff -ur mediawiki-1.2.2.bak/includes/Title.php mediawiki-1.2.2/includes/Title.php
--- mediawiki-1.2.2.bak/includes/Title.php	2004-02-24 00:09:03.000000000 +0000
+++ mediawiki-1.2.2/includes/Title.php	2004-03-31 13:36:45.000000000 +0100
@@ -75,7 +75,11 @@
 		
 		# For links that came from outside, check for alternate/legacy
 		# character encoding.
-		wfDebug( "Refer: {$_SERVER['HTTP_REFERER']}\n" );
+		if( isset( $_SERVER['HTTP_REFERER'] ) ) {
+			wfDebug( "Refer: {$_SERVER['HTTP_REFERER']}\n" );
+		} else {
+			wfDebug( "Refer: \n" );
+		}
 		wfDebug( "Servr: $wgServer\n" );
 		if( empty( $_SERVER["HTTP_REFERER"] ) ||
 			strncmp($wgServer, $_SERVER["HTTP_REFERER"], strlen( $wgServer ) ) )
diff -ur mediawiki-1.2.2.bak/includes/User.php mediawiki-1.2.2/includes/User.php
--- mediawiki-1.2.2.bak/includes/User.php	2004-03-10 05:10:17.000000000 +0000
+++ mediawiki-1.2.2/includes/User.php	2004-03-31 13:36:45.000000000 +0100
@@ -501,6 +501,8 @@
 
 	function logout()
 	{
+		global $wgDBname, $wgCookiePath, $wgCookieDomain;
+
 		$this->mId = 0;
 
 		$_SESSION['wsUserID'] = 0;
diff -ur mediawiki-1.2.2.bak/index.php mediawiki-1.2.2/index.php
--- mediawiki-1.2.2.bak/index.php	2004-03-28 02:06:22.000000000 +0100
+++ mediawiki-1.2.2/index.php	2004-03-31 13:36:45.000000000 +0100
@@ -59,7 +59,7 @@
 if( isset( $_SERVER['PATH_INFO'] ) && $wgUsePathInfo ) {
 	$title = substr( $_SERVER['PATH_INFO'], 1 );
 } else {
-	$title = $_REQUEST['title'];
+	$title = ( isset( $_REQUEST['title'] ) ? $_REQUEST['title'] : "" );
 }
 
 # Placeholders in case of DB error
