Index: /trunk/wifidog-auth/wifidog/include/language.php
===================================================================
--- /trunk/wifidog-auth/wifidog/include/language.php	(revision 1421)
+++ /trunk/wifidog-auth/wifidog/include/language.php	(revision 1433)
@@ -50,5 +50,12 @@
         $session = Session::getObject();
             //echo "Setting to $_REQUEST[wifidog_language]<br/>";
-        $session->set(SESS_LANGUAGE_VAR, $_REQUEST['wifidog_language']);
+        $AVAIL_LOCALE_ARRAY = LocaleList::getAvailableLanguageArray();
+        /* Try to guess the lang */
+        if (!empty($AVAIL_LOCALE_ARRAY[$_REQUEST['wifidog_language']])) {
+            $session->set(SESS_LANGUAGE_VAR, $_REQUEST['wifidog_language']);
+        }
+        else {
+            throw new Exception(htmlspecialchars($_REQUEST['wifidog_language'])." is not a valid locale");
+        }
 }
 
Index: /trunk/wifidog-auth/wifidog/classes/NodeList.php
===================================================================
--- /trunk/wifidog-auth/wifidog/classes/NodeList.php	(revision 1428)
+++ /trunk/wifidog-auth/wifidog/classes/NodeList.php	(revision 1433)
@@ -78,5 +78,5 @@
             require_once(NODE_LIST_CLASSES_DIR . "/NodeList" . $nodeListType . ".php");
         } else {
-            throw new Exception(_("The node list type '$nodeListType' is not supported!"));
+            throw new Exception(sprintf(_("The node list type '%s' is not supported!"), htmlspecialchars($nodeListType)));
         }
 
