diff --git a/app/controllers/admin/autoinsert.php b/app/controllers/admin/autoinsert.php
index 6edf3c68af2e1d847e11c807fa43d6331c30741f..fd3b7e0ff5629c99f5d7cda604fc12f270e8c55e 100644
--- a/app/controllers/admin/autoinsert.php
+++ b/app/controllers/admin/autoinsert.php
@@ -36,6 +36,10 @@ class Admin_AutoinsertController extends AuthenticatedController
      */
     public function index_action()
     {
+        $this->sem_search = '';
+        $this->sem_select = '';
+        $this->seminar_search = [];
+
         // search seminars
         if (Request::submitted('suchen')) {
             if (Request::get('sem_search')) {
@@ -142,6 +146,8 @@ class Admin_AutoinsertController extends AuthenticatedController
      */
     public function manual_action()
     {
+        $this->seminar_search = [];
+
         PageLayout::setTitle(_('Manuelles Eintragen von Nutzergruppen in Veranstaltungen'));
         if (Request::submitted('submit')) {
             $filters = array_filter(Request::getArray('filter'));
diff --git a/app/controllers/admin/coursewizardsteps.php b/app/controllers/admin/coursewizardsteps.php
index 75870065d16e17b0101b0f01bb574f44961eda64..4e70fa0414e4a4aaee6c0d4bcd96ed59c729dca1 100644
--- a/app/controllers/admin/coursewizardsteps.php
+++ b/app/controllers/admin/coursewizardsteps.php
@@ -52,6 +52,7 @@ class Admin_CourseWizardStepsController extends AuthenticatedController
      */
     public function edit_action($id='')
     {
+        $this->availableClasses = [];
         if ($id) {
             $title = _('Schritt bearbeiten');
             $this->step = CourseWizardStepRegistry::find($id);
@@ -63,7 +64,6 @@ class Admin_CourseWizardStepsController extends AuthenticatedController
             $this->step->number = 0;
             $this->step->enabled = false;
 
-            $this->availableClasses = [];
             foreach (get_declared_classes() as $className) {
                 if (is_a($className, "CourseWizardStep", true)
                         && $className !== "CourseWizardStep") {
diff --git a/app/controllers/admin/plugin.php b/app/controllers/admin/plugin.php
index 044fc50ca702736c541c69223ae80a2eb834e7a5..7a87d8fe275ad8ed04194625abc082de98c278f5 100644
--- a/app/controllers/admin/plugin.php
+++ b/app/controllers/admin/plugin.php
@@ -142,6 +142,7 @@ class Admin_PluginController extends AuthenticatedController
         $this->plugin_types  = $this->plugin_admin->getPluginTypes();
         $this->update_info   = $this->get_update_info($this->plugins);
         $this->migrations    = $this->plugin_admin->getMigrationInfo();
+        $this->num_updates   = 0;
 
         foreach ($this->update_info as $id => $info) {
             if (isset($info['update']) && !$this->plugins[$id]['depends']) {
diff --git a/app/controllers/admin/role.php b/app/controllers/admin/role.php
index 1e99a27051d62aafa3b545ed120ee1ff57493dd7..f932b0db3cd1f7084fbca2de79e0d0d4541035ea 100644
--- a/app/controllers/admin/role.php
+++ b/app/controllers/admin/role.php
@@ -152,18 +152,21 @@ class Admin_RoleController extends AuthenticatedController
             return;
         }
 
+        $this->username = Request::get('username');
+        $this->currentuser = null;
+        $this->assignedroles = [];
+        $this->all_userroles = [];
+
         // user search was started
         if (Request::submitted('search')) {
-            $username = Request::get('username');
 
-            if ($username == '') {
+            if ($this->username == '') {
                 $this->error = _('Es wurde kein Suchwort eingegeben.');
             } else {
-                $this->users = $this->search_user($username);
+                $this->users = $this->search_user($this->username);
 
                 if (count($this->users) === 0) {
                     $this->error = _('Es wurde keine Person gefunden.');
-                    $this->username = $username;
                 }
             }
         }
@@ -282,6 +285,7 @@ class Admin_RoleController extends AuthenticatedController
         $roleid = Request::int('role', $roleid);
 
         $this->roles = RolePersistence::getAllRoles();
+        $this->roleid = '';
 
         if ($roleid) {
             $sql = "SELECT DISTINCT Vorname,Nachname,user_id,username,perms
diff --git a/app/controllers/admin/user.php b/app/controllers/admin/user.php
index aaa59a0a23759beb3acfd8e03b994d5cf4cade84..cf1c80665d7e483c80c5b5c1aa1fdddf57c18e40 100644
--- a/app/controllers/admin/user.php
+++ b/app/controllers/admin/user.php
@@ -69,7 +69,7 @@ class Admin_UserController extends AuthenticatedController
         }
 
         //Suchparameter und Ergebnisse vorhanden
-        if (isset($_SESSION['admin']['user']) && $_SESSION['admin']['user']['results']) {
+        if (!empty($_SESSION['admin']['user']['results'])) {
             $request = $_SESSION['admin']['user'];
         }
 
@@ -81,6 +81,9 @@ class Admin_UserController extends AuthenticatedController
             }
         }
 
+        $this->request = [];
+        $this->users = [];
+
         //Datafields
         $this->datafields = [];
         $datafields = DataField::getDataFields("user");
@@ -96,6 +99,7 @@ class Admin_UserController extends AuthenticatedController
         });
 
         //wenn suche durchgeführt
+        $search_datafields = [];
         if (!empty($request)) {
             //suche mit datafields
             foreach ($this->datafields as $datafield) {
@@ -113,8 +117,8 @@ class Admin_UserController extends AuthenticatedController
                 $this->order = $this->order == 'desc' ? 'asc' : 'desc';
             }
 
-            $request['vorname']    = $request['vorname'] ?: null;
-            $request['nachname']   = $request['nachname'] ?: null;
+            $request['vorname']    = $request['vorname'] ?? null;
+            $request['nachname']   = $request['nachname'] ?? null;
             $request['inaktiv']    = $inaktiv;
             $request['datafields'] = $search_datafields;
             $request['sort']       = $this->sortby;
@@ -207,7 +211,8 @@ class Admin_UserController extends AuthenticatedController
         if ($advanced
             || !empty($search_datafields)
             || (!empty($request)
-                && ($request['auth_plugins'] || $request['userdomains'] || $request['degree'] || $request['institute'] || $request['studycourse'] || $request['show_only_not_lectures'] || !empty($request['roles']))
+                && (!empty($request['auth_plugins']) || !empty($request['userdomains']) || !empty($request['degree']) ||
+                    !empty($request['institute']) || !empty($request['studycourse']) || !empty($request['show_only_not_lectures']) || !empty($request['roles']))
             )
         ) {
             $this->advanced = true;
@@ -1621,7 +1626,7 @@ class Admin_UserController extends AuthenticatedController
         )->asDialog();
         $actions->addLink(
             _('Konten zusammenführen'),
-            $this->url_for('admin/user/migrate/' . (($this->user && is_array($this->user)) ? $this->user['user_id'] : '')),
+            $this->url_for('admin/user/migrate/' . ((!empty($this->user) && is_array($this->user)) ? $this->user['user_id'] : '')),
             Icon::create('community')
         );
 
@@ -1641,7 +1646,7 @@ class Admin_UserController extends AuthenticatedController
             );
         }
 
-        if (!is_object($this->user)) {
+        if (empty($this->user) || !is_object($this->user)) {
             return;
         }
 
diff --git a/app/controllers/course/studygroup.php b/app/controllers/course/studygroup.php
index 58032b86c322811446b0107826e298e954472304..b327a1afcb37538ad06f2a1f879e8533448d9caa 100644
--- a/app/controllers/course/studygroup.php
+++ b/app/controllers/course/studygroup.php
@@ -21,7 +21,7 @@ class Course_StudygroupController extends AuthenticatedController
         ) {
 
             // args at position zero is always the studygroup-id
-            if ($args[0] && $action == 'details') {
+            if (!empty($args[0]) && $action == 'details') {
                 if (SeminarCategories::GetBySeminarId($args[0])->studygroup_mode == false) {
                     throw new Exception(_('Dieses Seminar ist keine Studiengruppe!'));
                 }
diff --git a/app/controllers/event_log.php b/app/controllers/event_log.php
index 9638b095de40e554b2d58e4568786a8c5d734e5a..f1d19c60da3ffeb5f03faea5e0a37ea02e649d8b 100644
--- a/app/controllers/event_log.php
+++ b/app/controllers/event_log.php
@@ -42,10 +42,10 @@ class EventLogController extends AuthenticatedController
         $this->search      = trim(Request::get('search'));
         $this->log_actions = LogAction::getUsed(true);
         $this->types       = $this->event_log->get_object_types();
+        $this->type        = Request::option('type');
 
         // restrict log events to object scope
         if ($this->search) {
-            $this->type = Request::option('type');
             $objects = $this->event_log->find_objects(
                 $this->type,
                 $this->search,
diff --git a/app/controllers/help_content.php b/app/controllers/help_content.php
index a04c1684f27ec767ca9d11f1d7a58d6cb93fbc6e..5e8faf98473e217e59d6fbc22488303a82aed4c3 100644
--- a/app/controllers/help_content.php
+++ b/app/controllers/help_content.php
@@ -43,6 +43,7 @@ class HelpContentController extends AuthenticatedController
      */
     public function admin_overview_action()
     {
+        $this->help_content_searchterm = '';
         // initialize
         PageLayout::setTitle(_('Verwalten von Hilfe-Texten'));
         PageLayout::setHelpKeyword('Basis.HelpContentAdmin');
diff --git a/app/controllers/institute/members.php b/app/controllers/institute/members.php
index 29c325a0ef422a75ac05ae697823a53bf3ffbe1f..33d8eab38dca30c0e5e45993915a5fa685d35307 100644
--- a/app/controllers/institute/members.php
+++ b/app/controllers/institute/members.php
@@ -107,7 +107,7 @@ class Institute_MembersController extends AuthenticatedController
 
         // Show lock rule information
         $lockrule = LockRules::getObjectRule($this->institute->id);
-        if ($this->admin_view && $lockrule->description
+        if ($this->admin_view && !empty($lockrule->description)
                 && LockRules::Check($this->institute->id, 'participants')) {
             PageLayout::postInfo(formatLinks($lockrule->description));
         }
diff --git a/app/controllers/tour.php b/app/controllers/tour.php
index cda3ea41ceea3659d6d094fc896d57819b8c583c..54dfeff770cd1d73e80b186cb3e3450e32921604 100644
--- a/app/controllers/tour.php
+++ b/app/controllers/tour.php
@@ -180,6 +180,10 @@ class TourController extends AuthenticatedController
             throw new AccessDeniedException();
         }
 
+        $this->tour_searchterm = '';
+        $this->delete_question = '';
+        $this->filter_text = '';
+
         // initialize
         PageLayout::setTitle(_('Verwalten von Touren'));
         PageLayout::setHelpKeyword('Basis.TourAdmin');
@@ -443,6 +447,9 @@ class TourController extends AuthenticatedController
             $this->render_nothing();
             return;
         }
+
+        $this->force_route = '';
+
         // Output as dialog (Ajax-Request) or as Stud.IP page?
         PageLayout::setTitle(_('Schritt bearbeiten'));
         // save step position
@@ -613,6 +620,9 @@ class TourController extends AuthenticatedController
         if (!$this->help_admin) {
             throw new AccessDeniedException();
         }
+
+        $this->delete_question = '';
+
         // initialize
         PageLayout::setTitle(_('Verwalten von Touren'));
         PageLayout::setHelpKeyword('Basis.TourAdmin');
diff --git a/app/views/admin/autoinsert/index.php b/app/views/admin/autoinsert/index.php
index 774932971a375f77fb4b9a55cef55881df9404ee..6f863c551f0e8f1c078aa32383713a0f5aeb32e8 100644
--- a/app/views/admin/autoinsert/index.php
+++ b/app/views/admin/autoinsert/index.php
@@ -12,7 +12,7 @@ use Studip\Button, Studip\LinkButton;
 <? endif; ?>
     <form class="default" action="<?= $controller->index() ?>" method="post">
         <?= CSRFProtection::tokenTag() ?>
-        <?= $this->render_partial("admin/autoinsert/_search.php", ['semester_data' => $semester_data]) ?>
+        <?= $this->render_partial('admin/autoinsert/_search.php') ?>
     </form>
 
 <? if (is_array($seminar_search) && count($seminar_search) > 0): ?>
diff --git a/app/views/admin/autoinsert/manual.php b/app/views/admin/autoinsert/manual.php
index 612f56155828c804cca356c350570963b2d420d5..e081a10c7c5a711022ed84a5f8c3ebc3ef0626d4 100644
--- a/app/views/admin/autoinsert/manual.php
+++ b/app/views/admin/autoinsert/manual.php
@@ -10,7 +10,7 @@
 
 <form class="default" action="<?= $controller->manual() ?>" method="post">
     <?= CSRFProtection::tokenTag() ?>
-    <?= $this->render_partial("admin/autoinsert/_search.php", compact('semester_data', 'sem_search', 'sem_select')) ?>
+    <?= $this->render_partial('admin/autoinsert/_search.php', compact('sem_search', 'sem_select')) ?>
 </form>
 
 
diff --git a/app/views/admin/cronjobs/schedules/periodic-schedule.php b/app/views/admin/cronjobs/schedules/periodic-schedule.php
index b482efd3173586b848c4e4e4f23a6e6d4431dc42..021002adf559ebba72d393a91be2ef9601844474 100644
--- a/app/views/admin/cronjobs/schedules/periodic-schedule.php
+++ b/app/views/admin/cronjobs/schedules/periodic-schedule.php
@@ -9,7 +9,7 @@ $cronify = function ($n) {
     return $n;
 }
 ?>
-<? if ($display === 'table-cells'): ?>
+<? if (isset($display) && $display === 'table-cells'): ?>
     <td><?= $cronify($minute) ?></td>
     <td><?= $cronify($hour) ?></td>
     <td><?= $cronify($day) ?></td>
@@ -38,4 +38,4 @@ $cronify = function ($n) {
             <?= $cronify($day_of_week) ?>
         </li>
     </ul>
-<? endif ?>
\ No newline at end of file
+<? endif ?>
diff --git a/app/views/admin/plugin/index.php b/app/views/admin/plugin/index.php
index 859083babbb4775ac41be23681bbcae6e72f9860..26da74fe21f6cee3d92d967be87f96c5f4ae15b8 100644
--- a/app/views/admin/plugin/index.php
+++ b/app/views/admin/plugin/index.php
@@ -65,7 +65,7 @@ use Studip\Button, Studip\LinkButton;
                             <?= join(', ', $plugin['type']) ?>
                         </td>
                         <td <? if (!$plugin['enabled']) echo 'class="quiet"'; ?>>
-                            <?= htmlReady($update_info[$pluginid]['version']) ?>
+                            <?= htmlReady($update_info[$pluginid]['version'] ?? '') ?>
                         <? if ($plugin['automatic_update_url']): ?>
                             <?= Icon::create('install', Icon::ROLE_STATUS_RED)->asImg([
                                 'title' => _('Automatische Updates sind eingerichtet'),
@@ -75,8 +75,9 @@ use Studip\Button, Studip\LinkButton;
                         </td>
                         <td <? if (!$plugin['enabled']) echo 'class="quiet"'; ?>>
                         <? if (!$plugin['depends']) : ?>
-                            <?= htmlReady($migrations[$pluginid]['schema_version']) ?>
-                            <? if ($migrations[$pluginid]['schema_version'] < $migrations[$pluginid]['migration_top_version']): ?>
+                            <?= htmlReady($migrations[$pluginid]['schema_version'] ?? '') ?>
+                            <? if (!empty($migrations[$pluginid]['schema_version']) && !empty($migrations[$pluginid]['migration_top_version'])
+                                && ($migrations[$pluginid]['schema_version'] < $migrations[$pluginid]['migration_top_version'])): ?>
                                 <a href="<?= $controller->url_for('admin/plugin/migrate/' . $pluginid) ?>"
                                    title="<?= sprintf(_('Update auf Version %d verfügbar'), $migrations[$pluginid]['migration_top_version']) ?>">
                                     <?= Icon::create('plugin', Icon::ROLE_STATUS_RED) ?>
diff --git a/app/views/admin/specification/_field.php b/app/views/admin/specification/_field.php
index 30a01ffe202236a821d7805fb7851fc1a6e48a5e..6f089ea0867b45a392ec9dd8d127ef562f441d07 100644
--- a/app/views/admin/specification/_field.php
+++ b/app/views/admin/specification/_field.php
@@ -4,7 +4,7 @@ $order  = Request::getArray('order');
 ?>
 
 <section>
-    <? if ($required) : ?>
+    <? if (!empty($required)) : ?>
     <span class="required">
         <?= htmlReady($name) ?>
     </span>
@@ -28,7 +28,7 @@ $order  = Request::getArray('order');
             <?= _('Aktivieren') ?>
         </label>
         <label class="col-1">
-            <? if ($institution) : ?>
+            <? if (!empty($institution)) : ?>
                 <?= htmlReady($institution->name)?>
             <? endif; ?>
         </label>
diff --git a/app/views/admin/specification/edit.php b/app/views/admin/specification/edit.php
index de868a45da2a05bd34ce2994688911b55f6e5ccd..e8031714060cef78a420be14329a5e4d27b530c0 100644
--- a/app/views/admin/specification/edit.php
+++ b/app/views/admin/specification/edit.php
@@ -24,13 +24,13 @@ use Studip\Button, Studip\LinkButton;
             <span class="required">
                 <?= _('Name der Regel:') ?>
             </span>
-            <input type="text" name="rulename" value="<?= htmlReady(Request::get('rulename', $rule['name'])) ?>"
+            <input type="text" name="rulename" value="<?= htmlReady(Request::get('rulename', $rule ? $rule['name'] : '')) ?>"
                    required="required">
         </label>
         <label>
             <?= _('Beschreibung') ?>
             <textarea cols="60" rows="5"
-                      name="description"><?= htmlReady(Request::get('description', $rule['description'])) ?></textarea>
+                      name="description"><?= htmlReady(Request::get('description', $rule ? $rule['description'] : '')) ?></textarea>
         </label>
     </fieldset>
     <? if (count($entries_semdata) > 0) : ?>
diff --git a/app/views/admin/user/_results.php b/app/views/admin/user/_results.php
index 1406c2ad811a250fc7cb878526f5b6ff6fd9c8a5..695e30e200e685ab6a97768a57afab35fa312722 100644
--- a/app/views/admin/user/_results.php
+++ b/app/views/admin/user/_results.php
@@ -96,7 +96,7 @@
                     <td><?= htmlReady($user->nachname) ?></td>
                     <td><?= htmlReady($user->email) ?></td>
                     <td>
-                        <? if ($user->online->last_lifesign) :
+                        <? if (!empty($user->online->last_lifesign)) :
                             $inactive = time() - $user->online->last_lifesign;
                             if ($inactive < 3600 * 24) {
                                 $inactive = gmdate('H:i:s', $inactive);
@@ -188,7 +188,7 @@
 
                         }
 
-                        if (Privacy::isVisible($user_id)) {
+                        if (Privacy::isVisible($user->id)) {
                             $actionMenu->addLink(
                                 $controller->url_for("privacy/landing/{$user->id}"),
                                 _('Anzeige Personendaten'),
diff --git a/app/views/admin/user/index.php b/app/views/admin/user/index.php
index 50a69c4d9e0767711810a3ba8905535d5094fda5..0eb454079816f7da2fad156cd89cec72cd6da62d 100644
--- a/app/views/admin/user/index.php
+++ b/app/views/admin/user/index.php
@@ -13,22 +13,22 @@ use Studip\Button, Studip\LinkButton;
 
         <label class="col-3">
             <?= _('Benutzername') ?>
-            <input name="username" type="text" value="<?= htmlReady($request['username']) ?>">
+            <input name="username" type="text" value="<?= htmlReady($request['username'] ?? '') ?>">
         </label>
 
         <label class="col-3">
             <?= _('E-Mail') ?>
-            <input name="email" type="text" value="<?= htmlReady($request['email']) ?>">
+            <input name="email" type="text" value="<?= htmlReady($request['email'] ?? '') ?>">
         </label>
 
         <label class="col-3">
             <?= _('Vorname') ?>
-            <input name="vorname" type="text" value="<?= htmlReady($request['vorname']) ?>">
+            <input name="vorname" type="text" value="<?= htmlReady($request['vorname'] ?? '') ?>">
         </label>
 
         <label class="col-3">
             <?= _('Nachname') ?>
-            <input name="nachname" type="text" value="<?= htmlReady($request['nachname']) ?>">
+            <input name="nachname" type="text" value="<?= htmlReady($request['nachname'] ?? '') ?>">
         </label>
 
         <label class="col-2">
@@ -36,7 +36,7 @@ use Studip\Button, Studip\LinkButton;
 
             <select name="perm">
             <? foreach(words('alle user autor tutor dozent admin root') as $one): ?>
-                <option value="<?= $one ?>" <?= ($request['perm'] === $one) ? 'selected' : '' ?>>
+                <option value="<?= $one ?>" <?= (!empty($request['perm']) && $request['perm'] === $one) ? 'selected' : '' ?>>
                     <?= ($one === 'alle') ? _('alle') : $one ?>
                 </option>
             <? endforeach; ?>
@@ -49,20 +49,20 @@ use Studip\Button, Studip\LinkButton;
             <div class="hgroup">
                 <select name="inaktiv" class="size-s">
                 <? foreach(['<=' => '>=', '=' => '=', '>' => '<', 'nie' =>_('nie')] as $i => $one): ?>
-                    <option value="<?= htmlready($i) ?>" <?= ($request['inaktiv'][0] === $i) ? 'selected' : '' ?>>
+                    <option value="<?= htmlready($i) ?>" <?= (!empty($request['inaktiv'][0]) && $request['inaktiv'][0] === $i) ? 'selected' : '' ?>>
                         <?= htmlReady($one) ?>
                     </option>
                 <? endforeach; ?>
                 </select>
 
                 <input name="inaktiv_tage" type="number" id="inactive"
-                       value="<?= htmlReady($request['inaktiv'][1]) ?>">
+                       value="<?= htmlReady($request['inaktiv'][1] ?? '') ?>">
                 <?= _('Tage') ?>
             </div>
         </label>
 
         <label class="col-2" style="padding-top: 1.8em;">
-            <input type="checkbox" name="locked" value="1" <?=  ($request['locked']) ?  'checked' : '' ?>>
+            <input type="checkbox" name="locked" value="1" <?= !empty($request['locked']) ? 'checked' : '' ?>>
             <?= _('nur gesperrt') ?>
         </label>
     </fieldset>
@@ -123,7 +123,7 @@ use Studip\Button, Studip\LinkButton;
                 <? endforeach ?>
             </select>
         </label>
-        
+
         <label class="col-3">
             <?= _('Fachsemester') ?>
             <select name="fachsem">
@@ -180,7 +180,7 @@ use Studip\Button, Studip\LinkButton;
             <? endforeach ?>
             </select>
         <? else : ?>
-            <input type="text" name="<?= $datafield->id ?>" value="<?= htmlReady($request[$datafield->id]) ?>">
+            <input type="text" name="<?= htmlReady($datafield->id) ?>" value="<?= htmlReady($request[$datafield->id] ?? '') ?>">
         <? endif ?>
         </label>
     <? endforeach; ?>
@@ -199,7 +199,7 @@ use Studip\Button, Studip\LinkButton;
         <? endif?>
         <label>
             <input type="checkbox" name="show_only_not_lectures" value="1"
-                   <? if ($request['show_only_not_lectures']) echo 'checked'; ?>>
+                   <?= (!empty($request['show_only_not_lectures'])) ? 'checked' : '' ?>>
             <?= _('Nur Personen anzeigen, die in keiner Veranstaltung Lehrende sind')?>
         </label>
     </fieldset>
diff --git a/app/views/admission/ruleadministration/compatibility.php b/app/views/admission/ruleadministration/compatibility.php
index 2dc8aa4df6fa04314d56b04dd32caaca5f93cb94..d272bd083c8ad2d19b532f0565d40880590ab855 100644
--- a/app/views/admission/ruleadministration/compatibility.php
+++ b/app/views/admission/ruleadministration/compatibility.php
@@ -36,7 +36,7 @@
                         <td>
                             <input type="checkbox" name="compat[<?= $class ?>][]"
                                    value="<?= $compat_class ?>"<?=
-                                    in_array($compat_class, $matrix[$class] ?: []) ? ' checked' : ''?>>
+                                    in_array($compat_class, $matrix[$class] ?? []) ? ' checked' : ''?>>
                         </td>
                     <?php endforeach ?>
                 </tr>
@@ -51,5 +51,5 @@
             </tr>
         </tfoot>
     </table>
-  
+
 </form>
diff --git a/app/views/global_search/settings.php b/app/views/global_search/settings.php
index e4e1e0eb3a827a5b0af73de2eedbb350de638627..bf1764dfb6ade92d84ccc4fe4fd42622104ce476 100644
--- a/app/views/global_search/settings.php
+++ b/app/views/global_search/settings.php
@@ -65,7 +65,7 @@
                         <td>
                             <input type="checkbox" id="active[<?= htmlReady(get_class($module)) ?>]"
                                    name="modules[<?= htmlReady(get_class($module)) ?>][active]" value="1"
-                                <?= $config[get_class($module)]['active'] && !$resourcesInactive ? ' checked' : '' ?>
+                                <?= !empty($config[get_class($module)]['active']) && !$resourcesInactive ? ' checked' : '' ?>
                                 <?= $resourcesInactive ? ' disabled' : '' ?>>
                         </td>
                         <td>
diff --git a/app/views/institute/members/_table_body.php b/app/views/institute/members/_table_body.php
index 432125d4a95998ac02013397af4caeb05d39d35b..8bce6d2e80b15a665cbe64146791e9b24f1a96ac 100644
--- a/app/views/institute/members/_table_body.php
+++ b/app/views/institute/members/_table_body.php
@@ -4,7 +4,7 @@
         <th colspan="<?= 1 + count($structure) - ($structure['actions'] ? 1 : 0) ?>">
             <?= htmlReady($th_title) ?>
         </th>
-    <? if ($structure['actions']): ?>
+    <? if (!empty($structure['actions'])): ?>
         <th class="actions">
         <?= ActionMenu::get()
             ->setContext($th_title)
@@ -36,7 +36,7 @@
 <? foreach ($members as $member):
         $default_entries = DataFieldEntry::getDataFieldEntries([$member->user_id, $institute->id]);
 
-        if ($group) {
+        if (!empty($group)) {
             $role_entries = DataFieldEntry::getDataFieldEntries([$member->user_id, $group->id]);
         }
 ?>
@@ -57,25 +57,25 @@
             </a>
         <? endif; ?>
         </td>
-    <? if ($structure['status']): ?>
+    <? if (!empty($structure['status'])): ?>
         <td><?= htmlReady($member->inst_perms) ?></td>
     <? endif; ?>
-    <? if ($structure['statusgruppe']): ?>
+    <? if (!empty($structure['statusgruppe'])): ?>
         <td></td>
     <? endif; ?>
-    <? if ($structure['raum']): ?>
+    <? if (!empty($structure['raum'])): ?>
         <td><?= htmlReady($member->raum) ?></td>
     <? endif; ?>
-    <? if ($structure['sprechzeiten']): ?>
+    <? if (!empty($structure['sprechzeiten'])): ?>
         <td><?= htmlReady($member->sprechzeiten) ?></td>
     <? endif; ?>
-    <? if ($structure['telefon']): ?>
+    <? if (!empty($structure['telefon'])): ?>
         <td><?= htmlReady($member->Telefon) ?></td>
     <? endif; ?>
-    <? if ($structure['email']): ?>
+    <? if (!empty($structure['email'])): ?>
         <td><?= htmlReady(get_visible_email($member->user_id)) ?></td>
     <? endif; ?>
-    <? if ($structure['homepage']): ?>
+    <? if (!empty($structure['homepage'])): ?>
         <td><?= htmlReady($member->user_info->Home) ?></td>
     <? endif; ?>
     <? foreach (array_filter($datafields_list, function ($e) use ($structure) { return isset($structure[$e->getId()]); }) as $entry): ?>
@@ -87,7 +87,7 @@
         <? endif; ?>
         </td>
     <? endforeach; ?>
-    <? if ($structure['actions']): ?>
+    <? if (!empty($structure['actions'])): ?>
         <td class="actions">
         <?= ActionMenu::get()
             ->setContext($member->user)
@@ -120,7 +120,7 @@
         </td>
     <? endif; ?>
     </tr>
-<? if ($structure['statusgruppe']): ?>
+<? if (!empty($structure['statusgruppe'])): ?>
     <?
     $my_groups = $groups->filter(function ($group) use ($member) {
         return $group->isMember($member->user_id);
@@ -148,7 +148,7 @@
             <? endif; ?>
             </td>
         <? endforeach; ?>
-        <? if ($structure['actions']): ?>
+        <? if (!empty($structure['actions'])): ?>
             <td class="actions">
             <?= ActionMenu::get()
                 ->conditionAll($admin_view && !LockRules::Check($institute->id, 'participants'))
diff --git a/app/views/institute/members/index.php b/app/views/institute/members/index.php
index 17dc60236d54287db8133c763f73f3187ba60f51..25cf0aad5c5dc99b61a7be7c748efcf82c9ace68 100644
--- a/app/views/institute/members/index.php
+++ b/app/views/institute/members/index.php
@@ -5,15 +5,15 @@
             <col width="32">
         <? foreach ($structure as $key => $field): ?>
             <? if ($key !== 'statusgruppe'): ?>
-                <col <? if ($field['width']): ?> width="<?= $field['width'] ?>"<? endif; ?>>
+                <col <? if (!empty($field['width'])): ?> width="<?= htmlReady($field['width']) ?>"<? endif; ?>>
             <? endif; ?>
         <? endforeach; ?>
         </colgroup>
         <thead>
             <tr>
             <? foreach ($structure as $key => $field): ?>
-                <th <? if ($key === 'actions') echo 'class="actions"'; ?> <? if ($field['colspan']): ?>colspan="<?= $field['colspan'] ?>"<? endif; ?>>
-                <? if ($field['link']): ?>
+                <th <? if ($key === 'actions') echo 'class="actions"'; ?> <? if (!empty($field['colspan'])): ?>colspan="<?= $field['colspan'] ?>"<? endif; ?>>
+                <? if (!empty($field['link'])): ?>
                     <a href="<?= URLHelper::getLink($field['link']) ?>">
                         <?= htmlReady($field['name']) ?>
                     </a>
diff --git a/lib/classes/ActionMenu.php b/lib/classes/ActionMenu.php
index 92eac8dbcf8e874afa37c5364cc6741bf9593280..511c995416e4299e2603b72be6541e343fee27d5 100644
--- a/lib/classes/ActionMenu.php
+++ b/lib/classes/ActionMenu.php
@@ -111,7 +111,8 @@ class ActionMenu
                     'link'       => $url->link,
                     'icon'       => $url->icon,
                     'label'      => $url->label,
-                    'attributes' => $url->attributes
+                    'attributes' => $url->attributes,
+                    'index'      => $index
                 ];
             } else {
                 $action = [
@@ -120,6 +121,7 @@ class ActionMenu
                     'icon'       => $icon,
                     'label'      => $label,
                     'attributes' => $attributes,
+                    'index'      => $index
                 ];
             }
             $index = $index ?: md5($action['link'].json_encode($action['attributes']));
@@ -180,6 +182,7 @@ class ActionMenu
                 'icon'       => $icon,
                 'label'      => $label,
                 'attributes' => $attributes,
+                'index'      => ''
             ];
         }
 
@@ -198,6 +201,7 @@ class ActionMenu
             $this->actions[] = [
                 'type'   => 'multi-person-search',
                 'object' => $mp,
+                'index'  => ''
             ];
         }
 
diff --git a/lib/classes/EventLog.php b/lib/classes/EventLog.php
index b6481d2f52797c4984fa98b25e3f630d0452af36..7336415bd4c0ea402dc73783f99291bd1b018904 100644
--- a/lib/classes/EventLog.php
+++ b/lib/classes/EventLog.php
@@ -89,6 +89,7 @@ class EventLog
         $filter  = $this->sql_event_filter($action_id, $object_id, $parameters) ?: '1';
         $filter .= " ORDER BY mkdate DESC, event_id DESC LIMIT {$offset}, 50";
         $log_events = LogEvent::findBySQL($filter, $parameters);
+        $events = [];
 
         foreach ($log_events as $log_event) {
             $events[] = [
@@ -113,7 +114,7 @@ class EventLog
         foreach ($actions as $action) {
             $log_actions[$action->getId()] = $action->toArray();
             $log_actions[$action->getId()]['log_count']
-                    = (int) $log_count[$action->getId()];
+                    = (int) ($log_count[$action->getId()] ?? 0);
         }
 
         return $log_actions;
diff --git a/lib/classes/PluginAdministration.php b/lib/classes/PluginAdministration.php
index dc3f3bcc51dc095ca6d7acf78059c0d4447c3efa..dc8418e2c072b0aa3742106c7c7abf5502ad4895 100644
--- a/lib/classes/PluginAdministration.php
+++ b/lib/classes/PluginAdministration.php
@@ -327,6 +327,10 @@ class PluginAdministration
             $plugindir = Config::get()->PLUGINS_PATH . '/' . $plugin['path'];
             $manifest = $plugin_manager->getPluginManifest($plugindir);
 
+            if (!$manifest) {
+                continue;
+            }
+
             if (isset($manifest['updateURL'])) {
                 $repository = new PluginRepository($manifest['updateURL']);
             }
diff --git a/lib/classes/RangeTreeObject.class.php b/lib/classes/RangeTreeObject.class.php
index 95f98b8c24005f92b0bd93a7d3ec0c6e3f755c73..c4c5320d3fb13092ff7a3406c3455dd6ff4335e7 100644
--- a/lib/classes/RangeTreeObject.class.php
+++ b/lib/classes/RangeTreeObject.class.php
@@ -7,8 +7,8 @@
 // This file is part of Stud.IP
 // RangeTreeObject.class.php
 // Class to handle items in the "range tree"
-// 
-// Copyright (c) 2002 André Noack <noack@data-quest.de> 
+//
+// Copyright (c) 2002 André Noack <noack@data-quest.de>
 // Suchi & Berg GmbH <info@data-quest.de>
 // +---------------------------------------------------------------------------+
 // This program is free software; you can redistribute it and/or
@@ -28,18 +28,18 @@
 /**
 * base class for items in the "range tree"
 *
-* This class is used for items 
+* This class is used for items
 *
 * @access   public
 * @author   André Noack <noack@data-quest.de>
-* @package  
+* @package
 */
 class RangeTreeObject {
-    
+
     /**
     * item_id in range_tree
     *
-    * 
+    *
     * @access   public
     * @var      string $tree_item_id
     */
@@ -47,7 +47,7 @@ class RangeTreeObject {
     /**
     * References the tree object
     *
-    * 
+    *
     * @access   private
     * @var      object StudipRangeTree $tree
     */
@@ -55,25 +55,25 @@ class RangeTreeObject {
     /**
     * associative array with data from database fields
     *
-    * 
+    *
     * @access   public
     * @var      array $item_data
     */
     var $item_data = null;
-    
+
     /**
     * associative array with mapping for database fields
     *
-    * 
+    *
     * @access   public
     * @var      array $item_data_mapping
     */
     var $item_data_mapping = null;
-    
+
     /**
     * Factory method
     *
-    * 
+    *
     * @access public
     * @static
     * @param    string  $item_id
@@ -84,7 +84,7 @@ class RangeTreeObject {
         $class_name = "RangeTreeObject" . ucfirst($tree->tree_data[$item_id]['studip_object']);
         return new $class_name($item_id);
     }
-    
+
     /**
     * Constructor
     *
@@ -97,11 +97,11 @@ class RangeTreeObject {
         $this->tree_item_id = $item_id;
         $this->item_data = $this->tree->tree_data[$item_id];
     }
-    
+
     /**
     * Returns all tree items which are kids of this object
     *
-    * 
+    *
     * @access public
     * @param    boolean $as_value_list
     * @return   mixed   returns numeric array if param is false, else comma separated string
@@ -109,11 +109,11 @@ class RangeTreeObject {
     function getAllItemKids($as_value_list = false){
         return ($as_value_list) ? $this->getValueList($this->tree->getKidsKids($this->tree_item_id)) : $this->tree->getKidsKids($this->tree_item_id);
     }
-    
+
     /**
     * Returns all tree items which are kids of this object and are "real" Stud.IP objects
     *
-    * 
+    *
     * @access public
     * @param    boolean $as_value_list
     * @return   mixed   returns numeric array if param is false, else comma separated string
@@ -122,11 +122,11 @@ class RangeTreeObject {
         $all_object_kids = array_merge((array)$this->getInstKids(), (array)$this->getFakKids());
         return ($as_value_list) ? $this->getValueList($all_object_kids) : $all_object_kids;
     }
-    
+
     /**
     * Returns all tree items which are kids of this object and are Stud.IP "Einrichtungen"
     *
-    * 
+    *
     * @access public
     * @param    boolean $as_value_list
     * @return   mixed   returns numeric array if param is false, else comma separated string
@@ -141,11 +141,11 @@ class RangeTreeObject {
         }
         return ($as_value_list) ? $this->getValueList($inst_kids) : $inst_kids;
     }
-    
+
     /**
     * Returns all tree items which are kids of this object and are Stud.IP "Fakultaeten"
     *
-    * 
+    *
     * @access public
     * @param    boolean $as_value_list
     * @return   mixed   returns numeric array if param is false, else comma separated string
@@ -160,19 +160,19 @@ class RangeTreeObject {
         }
         return ($as_value_list) ? $this->getValueList($fak_kids) : $fak_kids;
     }
-    
+
     /**
     * Returns array of Stud.IP range_ids of "real" objects
     *
     * This function is a wrapper for the according function in StudipRangeTree
     * @see StudipRangeTree::getAdminRange()
     * @access   public
-    * @return   array   of primary keys from table "institute" 
+    * @return   array   of primary keys from table "institute"
     */
     function getAdminRange(){
         return $this->tree->getAdminRange($this->tree_item_id);
     }
-    
+
     /**
     * Only useful in RangeTreeObjectInst ,all other items are always in the correct branch
     *
@@ -182,24 +182,24 @@ class RangeTreeObject {
     function isInCorrectBranch(){
         return true;
     }
-    
+
     /**
     * Returns tree path of the current object
     *
     * This function is a wrapper for the according function in StudipRangeTree
     * @see StudipRangeTree::getItemPath()
     * @access public
-    * @return   string  
+    * @return   string
     */
     function getItemPath(){
         return $this->tree->getItemPath($this->tree_item_id);
     }
-    
+
     /**
     * extends the $item_data array
     *
     * This function fills the $item_data array with fields from the according database table (is of no use in the base class)
-    * @abstract 
+    * @abstract
     * @access private
     */
     function initItemDetail(){
@@ -220,7 +220,7 @@ class RangeTreeObject {
         }
     return false;
     }
-    
+
     /**
     * fetch categories of this object from database
     *
@@ -238,21 +238,21 @@ class RangeTreeObject {
         }
     return false;
     }
-    
+
     /**
     * getter method for categories of this object
     *
-    * 
+    *
     * @access public
     * @return   object DbSnapshot
     */
     function &getCategories(){
-        if (!is_object($this->item_data['categories'])){
+        if (empty($this->item_data['categories']) || !is_object($this->item_data['categories'])){
             $this->fetchCategories();
         }
         return $this->item_data['categories'];
     }
-    
+
     function fetchNumStaff(){
         $view = DbView::getView('range_tree');
         if (!($view->params[0] = $this->item_data['studip_object_id']))
@@ -264,15 +264,15 @@ class RangeTreeObject {
         }
         return false;
     }
-    
+
     function getNumStaff(){
         if(!isset($this->item_data['num_staff'])){
             $this->fetchNumStaff();
         }
         return $this->item_data['num_staff'];
     }
-    
-    
+
+
     /**
     * transform numerical array into a comma separated string
     *
@@ -281,12 +281,12 @@ class RangeTreeObject {
     * @param    array   $list
     * @return   string
     */
-    
+
     function getValueList($list){
         $value_list = false;
-        if (count($list) == 1) 
+        if (count($list) == 1)
             $value_list = "'$list[0]'";
-        else 
+        else
             $value_list = "'".join("','",$list)."'";
         return $value_list;
     }
diff --git a/lib/classes/SemClass.class.php b/lib/classes/SemClass.class.php
index 5ab5a2d54211ea1681ea433578b3b5f2a63486d0..dbbbcd7fa35cffdf326711bead14205e40f1a3b3 100644
--- a/lib/classes/SemClass.class.php
+++ b/lib/classes/SemClass.class.php
@@ -305,7 +305,7 @@ class SemClass implements ArrayAccess
      */
     public function isModuleActivated($modulename)
     {
-        return !$this->data['modules'][$modulename]
+        return empty($this->data['modules'][$modulename])
             ||  $this->data['modules'][$modulename]['activated'];
     }
 
@@ -316,7 +316,7 @@ class SemClass implements ArrayAccess
      */
     public function isModuleAllowed($modulename)
     {
-        return !$this->data['modules'][$modulename]
+        return empty($this->data['modules'][$modulename])
             || !$this->data['modules'][$modulename]['sticky']
             ||  $this->data['modules'][$modulename]['activated'];
     }
diff --git a/lib/classes/StudipForm.class.php b/lib/classes/StudipForm.class.php
index 88c36fe9b6b572ec5bb24720a73815250fb0b164..024e2e3e578bb6976db502a73d7480e5b43d48ca 100644
--- a/lib/classes/StudipForm.class.php
+++ b/lib/classes/StudipForm.class.php
@@ -182,7 +182,7 @@ class StudipForm {
             $attributes['required'] = 'required';
         }
 
-        if (!isset($attributes['id'])) {
+        if (empty($attributes['id'])) {
             $attributes['id'] = $this->form_name . '_' . $name;
         }
 
@@ -282,7 +282,7 @@ class StudipForm {
 
     function getFormFieldSelect($name, $attributes, $default){
         $ret = "\n<select name=\"{$this->form_name}_{$name}";
-        if (!empty($this->form_fields[$name]['multiple'])){
+        if (!empty($this->form_fields[$name]['multiple'])) {
             $ret .= "[]\" multiple ";
         } else {
             $ret .= "\" ";
@@ -292,9 +292,9 @@ class StudipForm {
         if ($default === false){
             $default = $this->form_fields[$name]['default_value'];
         }
-        if (!empty($this->form_fields[$name]['options']) && is_array($this->form_fields[$name]['options'])){
+        if (!empty($this->form_fields[$name]['options']) && is_array($this->form_fields[$name]['options'])) {
             $options = $this->form_fields[$name]['options'];
-        } else if ($this->form_fields[$name]['options_callback']){
+        } else if (!empty($this->form_fields[$name]['options_callback'])) {
             $options = call_user_func($this->form_fields[$name]['options_callback'],$this,$name);
         }
         for ($i = 0; $i < count($options); ++$i){
diff --git a/lib/classes/StudipRangeTree.class.php b/lib/classes/StudipRangeTree.class.php
index 291d443066192dc03e336b73d5dc4b8e589ad24c..36f7314782e289ad6e052d869941109b9c98b509 100644
--- a/lib/classes/StudipRangeTree.class.php
+++ b/lib/classes/StudipRangeTree.class.php
@@ -61,7 +61,7 @@ class StudipRangeTree extends TreeAbstract
         if (isset($args['sem_status']) ){
             $this->sem_status = array_map('intval', $args['sem_status']);
         }
-        $this->visible_only = (int)$args['visible_only'];
+        $this->visible_only = (int)($args['visible_only'] ?? 0);
         parent::__construct(); //calling the baseclass constructor
         $this->sem_dates = Semester::findAllVisible();
     }
diff --git a/lib/classes/StudipRangeTreeViewAdmin.class.php b/lib/classes/StudipRangeTreeViewAdmin.class.php
index 1bde3715be9c5ebd6d35d3ec4b95bb8c15233935..6c5f3499752d709170d9a5b94e417b5b949fd817 100644
--- a/lib/classes/StudipRangeTreeViewAdmin.class.php
+++ b/lib/classes/StudipRangeTreeViewAdmin.class.php
@@ -576,7 +576,7 @@ class StudipRangeTreeViewAdmin extends TreeView{
             return $content;
         }
         $range_object = RangeTreeObject::GetInstance($item_id);
-        $name = ($range_object->item_data['type']) ? $range_object->item_data['type'] . ": " : "";
+        $name = !empty($range_object->item_data['type']) ? $range_object->item_data['type'] . ": " : "";
         $name .= $range_object->item_data['name'];
         $content .= "\n<tr><td class=\"table_header_bold\" align=\"left\" style=\"font-size:10pt\">" . htmlReady($name) ." </td></tr>";
         if (is_array($range_object->item_data_mapping)){
@@ -728,7 +728,7 @@ class StudipRangeTreeViewAdmin extends TreeView{
         </div>
 
         <?
-        $content .= ob_get_clean();
+        $content = ob_get_clean();
         return $content;
     }
 
@@ -787,7 +787,7 @@ class StudipRangeTreeViewAdmin extends TreeView{
             </footer>
         </form>
 
-        <? $content .= ob_get_clean() . '</td></tr>';
+        <? $content = ob_get_clean() . '</td></tr>';
 
         return $content;
     }
@@ -795,7 +795,7 @@ class StudipRangeTreeViewAdmin extends TreeView{
     function getItemMessage($item_id, $colspan = 1)
     {
         $content = "";
-        if ($this->msg[$item_id]){
+        if (!empty($this->msg[$item_id])) {
             $msg = explode("§", $this->msg[$item_id]);
             $pics = [
                 'error' => Icon::create('decline', 'attention'),
diff --git a/lib/classes/StudipSemSearchHelper.class.php b/lib/classes/StudipSemSearchHelper.class.php
index e87da1bb95b3dc8ceb8fac34ffac39eb2455359f..ea7aa9c52e797c31c2de802bc3735e5d2d0dbe56 100644
--- a/lib/classes/StudipSemSearchHelper.class.php
+++ b/lib/classes/StudipSemSearchHelper.class.php
@@ -103,7 +103,7 @@ class StudipSemSearchHelper {
         if (isset($this->params['type']) && $this->params['type'] != 'all'){
             $sem_types = [$this->params['type']];
         }
-        if ($sem_types) {
+        if (!empty($sem_types) && is_array($sem_types)) {
             $clause = " AND c.status IN('" . join("','",$sem_types) . "') " . $clause;
         }
 
diff --git a/lib/classes/StudipSemTree.class.php b/lib/classes/StudipSemTree.class.php
index 82fd37ca588108dad204b271b7faee7c958da449..203bec15e389324bb18aa56919bfe993af2cf654 100644
--- a/lib/classes/StudipSemTree.class.php
+++ b/lib/classes/StudipSemTree.class.php
@@ -110,7 +110,7 @@ class StudipSemTree extends TreeAbstract
 
     public function isHiddenItem($item_id)
     {
-        return (bool) $GLOBALS['SEM_TREE_TYPES'][$this->getValue($item_id, 'type')]['hidden'];
+        return !empty($GLOBALS['SEM_TREE_TYPES'][$this->getValue($item_id, 'type')]['hidden']);
     }
 
     public function getSemIds($item_id,$ids_from_kids = false)
@@ -173,11 +173,11 @@ class StudipSemTree extends TreeAbstract
 
     public function getNumEntries($item_id, $num_entries_from_kids = false)
     {
-        if (!$this->tree_data[$item_id]) {
+        if (empty($this->tree_data[$item_id])) {
             return false;
         }
 
-        if (!$this->entries_init_done) {
+        if (empty($this->entries_init_done)) {
             $this->initEntries();
         }
 
diff --git a/lib/classes/StudipSemTreeViewAdmin.class.php b/lib/classes/StudipSemTreeViewAdmin.class.php
index 8644fef216c5fedb1f722013fc49c377294e6e51..c615f9859e1481931e73439bcd47f1eae42455a3 100644
--- a/lib/classes/StudipSemTreeViewAdmin.class.php
+++ b/lib/classes/StudipSemTreeViewAdmin.class.php
@@ -105,6 +105,7 @@ class StudipSemTreeViewAdmin extends TreeView
     }
 
     function parseCommand(){
+        $this->mode = '';
         if (Request::quoted('mode'))
         $this->mode = Request::quoted('mode');
         if (Request::option('cmd')){
@@ -483,7 +484,7 @@ class StudipSemTreeViewAdmin extends TreeView
         $head = $this->getItemHeadFrontPic($item_id);
         $head .= "\n<td  class=\"printhead\" nowrap  align=\"left\" valign=\"bottom\">";
         if ($this->tree->hasKids($item_id)){
-            $head .= Icon::create('folder-full', 'clickable', ['title' => $this->open_ranges[$item_id]?_('Alle Unterelemente schliessen'):_('Alle Unterelemente öffnen')])->asImg(16, ['class' => 'text-top']);
+            $head .= Icon::create('folder-full', Icon::ROLE_CLICKABLE, ['title' => !empty($this->open_ranges[$item_id]) ? _('Alle Unterelemente schliessen') : _('Alle Unterelemente öffnen')])->asImg(['class' => 'text-top']);
         } else {
             $head .= Icon::create('folder-empty', 'clickable', ['title' => _('Dieses Element hat keine Unterelemente')])->asImg();
         }
@@ -491,18 +492,18 @@ class StudipSemTreeViewAdmin extends TreeView
     }
 
     function getItemContent($item_id){
-        if ($item_id == $this->edit_item_id ) return $this->getEditItemContent();
-        if(!$GLOBALS['SEM_TREE_TYPES'][$this->tree->getValue($item_id, 'type')]['editable']){
+        if (!empty($this->edit_item_id) && ($item_id == $this->edit_item_id)) return $this->getEditItemContent();
+        if(empty($GLOBALS['SEM_TREE_TYPES'][$this->tree->getValue($item_id, 'type')]['editable'])){
             $is_not_editable = true;
             $this->msg[$item_id] = "info§" . sprintf(_("Der Typ dieses Elementes verbietet eine Bearbeitung."));
         }
-        if ($item_id == $this->move_item_id){
+        if (!empty($this->move_item_id) && ($item_id == $this->move_item_id)) {
             $this->msg[$item_id] = "info§" . sprintf(_("Dieses Element wurde zum Verschieben / Kopieren markiert. Bitte wählen Sie ein Einfügesymbol %s aus, um das Element zu verschieben / kopieren."), Icon::create('arr_2right', 'sort', ['title' => "Einfügesymbol"])->asImg(16, ["alt" => "Einfügesymbol"]));
         }
         $content = "\n<table width=\"90%\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\" style=\"font-size:10pt;\">";
         $content .= $this->getItemMessage($item_id);
         $content .= "\n<tr><td style=\"font-size:10pt;\">";
-        if(!$is_not_editable){
+        if (empty($is_not_editable)) {
             if ($this->isItemAdmin($item_id) ){
                 $content .= LinkButton::create(_('Neues Objekt'),
                         URLHelper::getURL($this->getSelf('cmd=NewItem&item_id='.$item_id)),
@@ -520,7 +521,7 @@ class StudipSemTreeViewAdmin extends TreeView
                         URLHelper::getURL($this->getSelf('cmd=AssertDeleteItem&item_id=' . $item_id)),
                         ['title' => _('Dieses Element löschen')]) . '&nbsp;';
 
-                if ($this->move_item_id == $item_id && ($this->mode == "MoveItem" || $this->mode == "CopyItem")){
+                if (!empty($this->move_item_id) && ($this->move_item_id == $item_id) && ($this->mode == "MoveItem" || $this->mode == "CopyItem")){
                     $content .= LinkButton::create(_('Abbrechen'),
                             URLHelper::getURL($this->getSelf('cmd=Cancel&item_id=' . $item_id)),
                             ['title' => _('Verschieben / Kopieren abbrechen')]) . '&nbsp;';
@@ -561,7 +562,7 @@ class StudipSemTreeViewAdmin extends TreeView
             $content .= formatReady($this->tree->tree_data[$item_id]['info']) . "</td></tr>";
         }
         $content .= "<tr><td style=\"font-size:10pt;\"colspan=\"3\">&nbsp;</td></tr>";
-        if ($this->tree->getNumEntries($item_id) - $this->tree->tree_data[$item_id]['lonely_sem']){
+        if (!empty($this->tree->tree_data[$item_id]['lonely_sem']) && ($this->tree->getNumEntries($item_id) - $this->tree->tree_data[$item_id]['lonely_sem'])) {
             $content .= "<tr><td class=\"table_row_even\" style=\"font-size:10pt;\" align=\"left\" colspan=\"3\"><b>" . _("Einträge auf dieser Ebene:");
             $content .= "</b>\n</td></tr>";
             $entries = $this->tree->getSemData($item_id);
@@ -569,7 +570,7 @@ class StudipSemTreeViewAdmin extends TreeView
         } else {
             $content .= "\n<tr><td class=\"table_row_even\" style=\"font-size:10pt;\" colspan=\"3\">" . _("Keine Einträge auf dieser Ebene vorhanden!") . "</td></tr>";
         }
-        if ($this->tree->tree_data[$item_id]['lonely_sem']){
+        if (!empty($this->tree->tree_data[$item_id]['lonely_sem'])) {
             $content .= "<tr><td class=\"table_row_even\" align=\"left\" style=\"font-size:10pt;\" colspan=\"3\"><b>" . _("Nicht zugeordnete Veranstaltungen auf dieser Ebene:");
             $content .= "</b>\n</td></tr>";
             $entries = $this->tree->getLonelySemData($item_id);
@@ -775,7 +776,7 @@ class StudipSemTreeViewAdmin extends TreeView
         if ($item_id != "root"){
             $head .= " (" . $this->tree->getNumEntries($item_id,true) . ") " ;
         }
-        if ($item_id != $this->start_item_id && $this->isParentAdmin($item_id) && $item_id != $this->edit_item_id){
+        if ($item_id != $this->start_item_id && $this->isParentAdmin($item_id) && !empty($this->edit_item_id) && ($item_id != $this->edit_item_id)){
             $head .= "</td><td nowrap align=\"right\" valign=\"bottom\" class=\"printhead\">";
             if (!$this->tree->isFirstKid($item_id)){
                 $head .= "<a href=\"". URLHelper::getLink($this->getSelf("cmd=OrderItem&direction=up&item_id=$item_id")) .
@@ -794,7 +795,7 @@ class StudipSemTreeViewAdmin extends TreeView
 
     function getItemMessage($item_id,$colspan = 1){
         $content = "";
-        if ($this->msg[$item_id]){
+        if (!empty($this->msg[$item_id])) {
             $msg = explode("§",$this->msg[$item_id]);
             $pics = [
                 'error' => Icon::create('decline', 'attention'),
diff --git a/lib/classes/TreeView.class.php b/lib/classes/TreeView.class.php
index b2d8f5b851eafd4fd3968cd12065e4859f3e865c..243a9b9e6312ba42b342a6a7fdb4f462a423c127 100644
--- a/lib/classes/TreeView.class.php
+++ b/lib/classes/TreeView.class.php
@@ -168,7 +168,7 @@ class TreeView {
 
         $toggle_item = Request::option('close_item') ?: Request::option('open_item');
         if ($toggle_item){
-            if ($this->open_items[$toggle_item]) {
+            if (!empty($this->open_items[$toggle_item])) {
                 unset($this->open_items[$toggle_item]);
             } else {
                 $this->openItem($toggle_item);
@@ -216,7 +216,7 @@ class TreeView {
     for ($j = 0; $j < $num_items; ++$j){
         $this->printLevelOutput($items[$j]);
         $this->printItemOutput($items[$j]);
-        if ($this->tree->hasKids($items[$j]) && $this->open_ranges[$items[$j]]) {
+        if ($this->tree->hasKids($items[$j]) && !empty($this->open_ranges[$items[$j]])) {
             $this->showTree($this->tree->tree_childs[$items[$j]]);
         }
     }
@@ -276,7 +276,7 @@ class TreeView {
         echo "\n</td><td class=\"printhead\" align=\"left\" width=\"99%\" nowrap valign=\"bottom\">";
         echo $this->getItemHead($item_id);
         echo "</td></tr></table>";
-        if ($this->open_items[$item_id]) {
+        if (!empty($this->open_items[$item_id])) {
             $this->printItemDetails($item_id);
         }
         return;
@@ -318,7 +318,7 @@ class TreeView {
                 else
                     $level_output = "<td class=\"blank\" background=\"" . Assets::image_path('forumstrich.gif') . "\">"
                                   . Assets::img('forumleer.gif', ['size' => '10@20'])
-                                  . "</td>" . $level_output; //vertical line
+                                  . "</td>" . ($level_output ?? ''); //vertical line
             }
         }
         //$level_output = "<td class=\"blank\" background=\"".$GLOBALS['ASSETS_URL']."images/forumleer.gif\" ><img src=\"".$GLOBALS['ASSETS_URL']."images/forumleer.gif\" width=\"20\" height=\"20\" border=\"0\" ></td>" . $level_output;
@@ -342,9 +342,11 @@ class TreeView {
         $head .= "\n<td  class=\"printhead\" nowrap align=\"left\" valign=\"bottom\">";
         if ($this->tree->hasKids($item_id)){
             $head .= "<a href=\"";
-            $head .= ($this->open_ranges[$item_id]) ? URLHelper::getLink($this->getSelf("close_range={$item_id}")) : URLHelper::getLink($this->getSelf("open_range={$item_id}"));
+            $head .= !empty($this->open_ranges[$item_id])
+                ? URLHelper::getLink($this->getSelf("close_range={$item_id}"))
+                : URLHelper::getLink($this->getSelf("open_range={$item_id}"));
             $head .= "\">";
-            $head .= Icon::create('folder-full', 'clickable', ['title' => $this->open_ranges[$item_id]?_('Alle Unterelemente schließen'):_('Alle Unterelemente öffnen')])->asImg(16, ['class' => 'text-top']);
+            $head .= Icon::create('folder-full', 'clickable', ['title' => !empty($this->open_ranges[$item_id]) ? _('Alle Unterelemente schließen') : _('Alle Unterelemente öffnen')])->asImg(16, ['class' => 'text-top']);
             $head .= "</a>";
         } else {
             $head .= Icon::create('folder-empty', 'clickable', ['title' => _('Dieses Element hat keine Unterelemente')])->asImg();
@@ -362,9 +364,10 @@ class TreeView {
             $head = "<td class=\"printhead\" nowrap align=\"left\" valign=\"bottom\">";
         }
         $head .= "<a href=\"";
-        $head .= ($this->open_items[$item_id])? URLHelper::getLink($this->getSelf("close_item={$item_id}")) . "\"" . tooltip(_("Dieses Element schließen"),true) . ">"
-                                            : URLHelper::getLink($this->getSelf("open_item={$item_id}")) . "\"" . tooltip(_("Dieses Element öffnen"),true) . ">";
-        $head .= Assets::img($this->open_items[$item_id] ? $this->pic_open : $this->pic_close);
+        $head .= !empty($this->open_items[$item_id])
+            ? URLHelper::getLink($this->getSelf("close_item={$item_id}")) . "\"" . tooltip(_("Dieses Element schließen"),true) . ">"
+            : URLHelper::getLink($this->getSelf("open_item={$item_id}")) . "\"" . tooltip(_("Dieses Element öffnen"),true) . ">";
+        $head .= Assets::img(!empty($this->open_items[$item_id]) ? $this->pic_open : $this->pic_close);
         #$head .= (!$this->open_items[$item_id]) ? "<img  src=\"".$GLOBALS['ASSETS_URL']."images/forumleer.gif\" width=\"5\" border=\"0\">" : "";
         $head .= "</a>";
         $head .= '</td>';
@@ -381,10 +384,11 @@ class TreeView {
     function getItemHead($item_id){
         $head = "";
         $head .= "&nbsp;<a class=\"tree\" href=\"";
-        $head .= ($this->open_items[$item_id])? URLHelper::getLink($this->getSelf("close_item={$item_id}")) . "\"" . tooltip(_("Dieses Element schließen"),true) . "><b>"
-                                            : URLHelper::getLink($this->getSelf("open_item={$item_id}")) . "\"" . tooltip(_("Dieses Element öffnen"),true) . ">";
+        $head .= !empty($this->open_items[$item_id])
+            ? URLHelper::getLink($this->getSelf("close_item={$item_id}")) . "\"" . tooltip(_("Dieses Element schließen"),true) . "><b>"
+            : URLHelper::getLink($this->getSelf("open_item={$item_id}")) . "\"" . tooltip(_("Dieses Element öffnen"),true) . ">";
         $head .= htmlReady(my_substr($this->tree->tree_data[$item_id]['name'],0,$this->max_cols));
-        $head .= ($this->open_items[$item_id]) ? "</b></a>" : "</a>";
+        $head .= (!empty($this->open_items[$item_id])) ? "</b></a>" : "</a>";
         return $head;
     }
 
diff --git a/lib/classes/URLHelper.php b/lib/classes/URLHelper.php
index ae83022dd9b303bda9f9eb0f9b51ca095013bf8c..732ce995dac50d901244c99df7564158d808f155 100644
--- a/lib/classes/URLHelper.php
+++ b/lib/classes/URLHelper.php
@@ -69,7 +69,7 @@ class URLHelper
 
         if ($url[0] === '/') {
             preg_match('%^[a-z]+://[\w:.-]+%', $base_url, $host);
-            $base_url = isset($host) ? $host[0] : '';
+            $base_url = $host[0] ?? '';
         }
 
         return $base_url.$url;
diff --git a/lib/classes/restapi/Router.php b/lib/classes/restapi/Router.php
index a66463ec91d8c4ab458c052113a90979d0379be8..d6a331c98a6fa57e5192d665ef24debc8f6876cc 100644
--- a/lib/classes/restapi/Router.php
+++ b/lib/classes/restapi/Router.php
@@ -322,8 +322,8 @@ class Router
                 }
                 if ($describe) {
                     $result[$uri][$method] = [
-                        'description' => $this->descriptions[$uri][$method] ?: null,
-                        'source'      => $route['source'] ?: 'unknown',
+                        'description' => $this->descriptions[$uri][$method] ?? null,
+                        'source'      => $route['source'] ?? 'unknown',
                     ];
                 } else {
                     $result[$uri][] = $method;
diff --git a/lib/classes/searchtypes/RangeSearch.class.php b/lib/classes/searchtypes/RangeSearch.class.php
index ee7f969815e0754008d79cfec4a7c7cb917f2fa3..b9c83ae07f0cc1ab89966231c8db74983cb7949b 100644
--- a/lib/classes/searchtypes/RangeSearch.class.php
+++ b/lib/classes/searchtypes/RangeSearch.class.php
@@ -10,6 +10,7 @@ class RangeSearch extends SQLSearch
 
     public function __construct()
     {
+        $this->avatarLike = $this->search = '';
         $this->sql = $this->getSQL();
     }
 
diff --git a/lib/extern/admin_extern.inc.php b/lib/extern/admin_extern.inc.php
index 0b6affea54f9d2f0628be2a36e4deccbf32f876b..fd436c440d4290c961508a960a080a33ceafece7 100644
--- a/lib/extern/admin_extern.inc.php
+++ b/lib/extern/admin_extern.inc.php
@@ -315,7 +315,7 @@ else {
 }
 
 
-if (!$have_config) {
+if (empty($have_config)) {
     echo "<blockquote>\n";
     echo _("Es wurden noch keine Konfigurationen angelegt.");
     echo "</blockquote>";
diff --git a/lib/extern/lib/ExternConfig.class.php b/lib/extern/lib/ExternConfig.class.php
index 226dbe7db7b856919741b2027d70235abb27711c..4c34625d3809c963e4755dbfbb74ed81270a9ecc 100644
--- a/lib/extern/lib/ExternConfig.class.php
+++ b/lib/extern/lib/ExternConfig.class.php
@@ -121,7 +121,7 @@ class ExternConfig
     {
         foreach ($config as $element_name => $element) {
             if (is_array($element)) foreach ($element as $attribute => $value) {
-                if ((string)$value[0] == '|') {
+                if (!empty($value[0]) && (string)$value[0] == '|') {
                     $new_config[$element_name][$attribute] = explode('|', mb_substr($value, 1));
                 } else {
                     $new_config[$element_name][$attribute] = $value;
diff --git a/lib/extern/lib/ExternConfigDb.class.php b/lib/extern/lib/ExternConfigDb.class.php
index 1f23a8613858fcb4a6688a385e21b968d20dc2a9..c1ab29b4ad39682911695cdec1a7377c9a16db02 100644
--- a/lib/extern/lib/ExternConfigDb.class.php
+++ b/lib/extern/lib/ExternConfigDb.class.php
@@ -77,7 +77,7 @@ class ExternConfigDb extends ExternConfig
         if (!parent::insertConfiguration()) {
             return false;
         }
-         $serialized_config = json_encode($this->config);
+         $serialized_config = json_encode($this->config ?? null);
          $time = time();
          $query = "INSERT INTO extern_config VALUES (?, ?, ?, ?, 0, ?, ?, ?)";
          $statement = DBManager::get()->prepare($query);
diff --git a/lib/extern/views/extern_edit_module.inc.php b/lib/extern/views/extern_edit_module.inc.php
index 8c4bac412fa376777adc3e35fdda3b6ef82bf8f5..21c5c8846220ef4f7d60015928a3f9e051e88df6 100644
--- a/lib/extern/views/extern_edit_module.inc.php
+++ b/lib/extern/views/extern_edit_module.inc.php
@@ -145,7 +145,7 @@ if (Request::option('com') == 'store') {
 }
 
 
-if (!$edit_open[$edit]) {
+if (empty($edit_open[$edit])) {
     echo  LinkButton::create("<< " . _("Zurück"), URLHelper::getURL('?list=TRUE'));;
 }
 
diff --git a/lib/functions.php b/lib/functions.php
index 9986104b50e54b45edd408434135630715a7ab4f..a86a9c4b9d55f8f7a6db1190b3758b072cbfa745 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -1420,7 +1420,7 @@ function get_route($route = '')
     if (mb_strpos($route, 'plugins.php/') !== false) {
         $trails = explode('plugins.php/', $route);
         $pieces = explode('/', $trails[1]);
-        $route = 'plugins.php/' . $pieces[0] . ($pieces[1] ? '/' . $pieces[1] : '') . ($pieces[2] ? '/' . $pieces[2] : '');
+        $route = 'plugins.php/' . $pieces[0] . (!empty($pieces[1]) ? '/' . $pieces[1] : '') . (!empty($pieces[2]) ? '/' . $pieces[2] : '');
     } elseif (mb_strpos($route, 'dispatch.php/') !== false) {
         $trails = explode('dispatch.php/', $route);
         $dispatcher = new StudipDispatcher();
diff --git a/lib/models/LogEvent.php b/lib/models/LogEvent.php
index 38fdd72dfb1a416d0c7dc65033859831b7e58ba6..2e83590da9fb13224641e86881934cb3b6f0d2d2 100644
--- a/lib/models/LogEvent.php
+++ b/lib/models/LogEvent.php
@@ -279,7 +279,7 @@ class LogEvent extends SimpleORMap implements PrivacyObject
     protected function formatSemester($field) {
         $all_semester = Semester::findAllVisible(false);
         foreach ($all_semester as $val) {
-            if ($val['beginn'] == $this->$field) {
+            if (!empty($val['beginn']) && ($val['beginn'] == $this->$field)) {
                 return '<em>' . $val['name'] . '</em>';
             }
         }
diff --git a/lib/models/OERHost.php b/lib/models/OERHost.php
index 7cb2ba5c9d4d9e04dd50221a581fba1e438f357c..1c7c01e9acf6b6149d979b6d58dfe7607ab0a417 100644
--- a/lib/models/OERHost.php
+++ b/lib/models/OERHost.php
@@ -15,7 +15,7 @@ class OERHost extends OERIdentity
     {
         $host = self::findOneBySQL("`private_key` IS NOT NULL AND `sorm_class` = 'OERHost' LIMIT 1");
         if ($host) {
-            $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/";
+            $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/";
             if ($host->isFieldDirty("url")) {
                 $host->store();
             }
@@ -23,7 +23,7 @@ class OERHost extends OERIdentity
         } else {
             $host = new self();
             $host['name'] = Config::get()->UNI_NAME_CLEAN;
-            $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/";
+            $host['url'] = $GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/";
             $host['last_updated'] = time();
             $host->store();
             return $host;
diff --git a/lib/models/SimpleCollection.class.php b/lib/models/SimpleCollection.class.php
index 588de1b871d4bb6925e67dd0c064307b0dbc59aa..26439b233f04e23105d4d8786e2a0d40badfed1b 100644
--- a/lib/models/SimpleCollection.class.php
+++ b/lib/models/SimpleCollection.class.php
@@ -684,9 +684,9 @@ class SimpleCollection extends StudipArrayObject
 
         $func = function ($d1, $d2) use ($sorter, $sort_func, $sort_locale) {
             do {
-                $field = current($sorter);
-                $dir = $field[1] ?? '';
-                $field = $field[0] ?? '';
+                $current_sorter = current($sorter);
+                $field = $current_sorter[0];
+                $dir = $current_sorter[1] ?? '';
                 if (!$sort_locale) {
                     $value1 = $d1[$field];
                     $value2 = $d2[$field];
diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php
index 5fed34a9a5b682a727afca44e1f975741364e331..bc670d8ed688b189278e9b1bb95e6be75c2c9736 100644
--- a/lib/models/SimpleORMap.class.php
+++ b/lib/models/SimpleORMap.class.php
@@ -1094,14 +1094,14 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
         }
         if ($type === 'has_and_belongs_to_many') {
             $thru_table = $options['thru_table'];
-            if (!$options['thru_key']) {
+            if (empty($options['thru_key'])) {
                 $options['thru_key'] = $this->pk()[0];
             }
             if (empty($options['thru_assoc_key']) || empty($options['assoc_foreign_key'])) {
                 $class = $options['class_name'];
                 $record = new $class();
                 $meta = $record->getTableMetadata();
-                if (!$options['thru_assoc_key'] ) {
+                if (empty($options['thru_assoc_key'])) {
                     $options['thru_assoc_key'] = $meta['pk'][0];
                 }
                 if (empty($options['assoc_foreign_key'])) {
diff --git a/lib/models/User.class.php b/lib/models/User.class.php
index 7ce868bf2222d1b78299e2b346315ff2578eaa00..7eb13218177ef5c464bcb651f24992a2b150e5df 100644
--- a/lib/models/User.class.php
+++ b/lib/models/User.class.php
@@ -365,7 +365,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         }
 
         //locked user
-        if ((int)$attributes['locked'] == 1) {
+        if (!empty($attributes['locked'])) {
             $where[] = "au.`locked` = 1";
         }
 
diff --git a/lib/plugins/engine/PluginManager.class.php b/lib/plugins/engine/PluginManager.class.php
index 7193f317f6b8806af5d6c03313a886b70b773845..7ced174ed380f614d476022b202f6a89b6ba8ac0 100644
--- a/lib/plugins/engine/PluginManager.class.php
+++ b/lib/plugins/engine/PluginManager.class.php
@@ -657,9 +657,9 @@ class PluginManager
         }
 
         foreach ($manifest as $line) {
-            list($key, $value) = explode('=', $line);
-            $key = trim($key);
-            $value = trim($value);
+            $key_and_value = explode('=', $line);
+            $key = trim($key_and_value[0]);
+            $value = trim($key_and_value[1] ?? '');
 
             // skip empty lines and comments
             if ($key === '' || $key[0] === '#') {
diff --git a/lib/plugins/engine/PluginRepository.class.php b/lib/plugins/engine/PluginRepository.class.php
index ef09a6c30d4e983706ff69e45ffb045c06cfb137..14415f42bd097602608bcb936048b7f8f90b6886 100644
--- a/lib/plugins/engine/PluginRepository.class.php
+++ b/lib/plugins/engine/PluginRepository.class.php
@@ -116,7 +116,7 @@ class PluginRepository
      */
     protected function registerPlugin($name, $meta_data)
     {
-        $old_data = $this->plugins[$name];
+        $old_data = $this->plugins[$name] ?? null;
 
         if (!isset($old_data) ||
             version_compare($meta_data['version'], $old_data['version']) > 0) {
@@ -132,7 +132,7 @@ class PluginRepository
      */
     public function getPlugin($name)
     {
-        return $this->plugins[$name];
+        return $this->plugins[$name] ?? null;
     }
 
     /**
diff --git a/lib/visual.inc.php b/lib/visual.inc.php
index 303987d76fd30811294286246546779420a462f6..9cf78c3f42bbb434d8f390a28c48abf5e2a9ccbc 100644
--- a/lib/visual.inc.php
+++ b/lib/visual.inc.php
@@ -679,7 +679,7 @@ function TransformInternalLinks($str){
         }
         $str = $GLOBALS['ABSOLUTE_URI_STUDIP'] . $str;
     }
-    if (is_array($GLOBALS['STUDIP_DOMAINS']) && count($GLOBALS['STUDIP_DOMAINS']) > 1) {
+    if (!empty($GLOBALS['STUDIP_DOMAINS']) && count($GLOBALS['STUDIP_DOMAINS']) > 1) {
         if (!isset($GLOBALS['TransformInternalLinks_domainData'])){
             $domain_data['domains'] = '';
             foreach ($GLOBALS['STUDIP_DOMAINS'] as $studip_domain) $domain_data['domains'] .= '|' . preg_quote($studip_domain);
diff --git a/templates/shared/semester-selector.php b/templates/shared/semester-selector.php
index 74761bf8027685c6d1f13052abe562a3877d59f3..1e559f5f039659386a30036b3d4a2aba5566e9d1 100644
--- a/templates/shared/semester-selector.php
+++ b/templates/shared/semester-selector.php
@@ -1,3 +1,4 @@
+<? $attributes = ''; ?>
 <? foreach ($select_attributes as $key => $value) : ?>
     <? $attributes .= sprintf('%s = "%s"', $key, $value) ?>
 <? endforeach ?>