Undefined variable: _SESSION in template.php
Apparently the $_SESSION variable is not available on the login page (I don't know why, but probably to avoid conflicts with logged in users trying to log in again). 

Try checking for it before you try to unset it:

function theme_preprocess_page(&amp;$vars) {
    if (variable_get('maintenance_mode', 0) &amp;&amp; isset($_SESSION['messages']['status'])) { //no maintenance mode message on front-end
      $message_count = count($_SESSION['messages']['status']);
      if($message_count &gt; 1) {
        array_shift($_SESSION['messages']['status']);
      }
      else {
        unset($_SESSION['messages']['status']);
      }
    }
}