diff --git a/bundled-libs/Smarty/libs/sysplugins/smarty_internal_debug.php b/bundled-libs/Smarty/libs/sysplugins/smarty_internal_debug.php
index 24b233e2..d4c9795a 100644
--- a/bundled-libs/Smarty/libs/sysplugins/smarty_internal_debug.php
+++ b/bundled-libs/Smarty/libs/sysplugins/smarty_internal_debug.php
@@ -69,8 +69,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
     public function end_template(Smarty_Internal_Template $template)
     {
         $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
+        if (isset($this->template_data[ $this->index ][ $key ][ 'start_template_time' ])) {
+            $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
+                microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
+        }
         //$this->template_data[$this->index][$key]['properties'] = $template->properties;
     }
 
@@ -142,8 +144,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
     public function end_render(Smarty_Internal_Template $template)
     {
         $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
+        if (isset($this->template_data[ $this->index ][ $key ][ 'start_time' ])) {
+            $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
+                    microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
+        }
     }
 
     /**
diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php
index 7ca7a539..7e4fd519 100644
--- a/include/admin/comments.inc.php
+++ b/include/admin/comments.inc.php
@@ -375,7 +375,7 @@ $data['formtoken']     = serendipity_setFormToken();
 $data['get']['filter'] = $serendipity['GET']['filter']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
 $data['commentReplied'] = false;
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/admin/configuration.inc.php b/include/admin/configuration.inc.php
index 68976740..a1ed1a0e 100644
--- a/include/admin/configuration.inc.php
+++ b/include/admin/configuration.inc.php
@@ -65,7 +65,7 @@ if ($_POST['installAction'] == 'check' && serendipity_checkFormToken()) {
 
 $data['config'] = serendipity_printConfigTemplate(serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE), $serendipity, false, true);
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/admin/entries_overview.inc.php b/include/admin/entries_overview.inc.php
index 9bdc9723..f086ca83 100644
--- a/include/admin/entries_overview.inc.php
+++ b/include/admin/entries_overview.inc.php
@@ -4,7 +4,7 @@ if (IN_serendipity !== true) {
     die ('Don\'t hack!');
 }
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/admin/groups.inc.php b/include/admin/groups.inc.php
index 2acd5626..382d3982 100644
--- a/include/admin/groups.inc.php
+++ b/include/admin/groups.inc.php
@@ -32,7 +32,7 @@ if (isset($_POST['SAVE_NEW']) && serendipity_checkFormToken()) {
 /* Edit a group */
 if (isset($_POST['SAVE_EDIT']) && serendipity_checkFormToken()) {
     $perms = serendipity_getAllPermissionNames();
-    serendipity_updateGroupConfig($serendipity['POST']['group'], $perms, $serendipity['POST'], false, $serendipity['POST']['forbidden_plugins'], $serendipity['POST']['forbidden_hooks']);
+    serendipity_updateGroupConfig($serendipity['POST']['group'], $perms, $serendipity['POST'], false, ($serendipity['POST']['forbidden_plugins'] ?? null), ($serendipity['POST']['forbidden_hooks'] ?? null));
     $data['save_edit'] = true;
     $data['name'] = $serendipity['POST']['name'];
 }
diff --git a/include/admin/images.inc.php b/include/admin/images.inc.php
index 4c65e08b..319c6720 100644
--- a/include/admin/images.inc.php
+++ b/include/admin/images.inc.php
@@ -10,7 +10,7 @@ if (!serendipity_checkPermission('adminImages')) {
 
 $data = array();
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
@@ -518,8 +518,8 @@ switch ($serendipity['GET']['adminAction']) {
                 $use_dir = $newDir;
             }
 
-            serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'], $use_dir);
-            serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'], $use_dir);
+            serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'] ?? null, $use_dir);
+            serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'] ?? null, $use_dir);
             $data['print_SETTINGS_SAVED_AT'] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
         }
 
diff --git a/include/admin/import.inc.php b/include/admin/import.inc.php
index 1d5192ba..9da8219d 100644
--- a/include/admin/import.inc.php
+++ b/include/admin/import.inc.php
@@ -252,7 +252,7 @@ if (isset($serendipity['GET']['importFrom']) && serendipity_checkFormToken()) {
     $data['list'] = $list;
 }
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/admin/importers/b2evolution.inc.php b/include/admin/importers/b2evolution.inc.php
index c58e73a5..1ab182f8 100644
--- a/include/admin/importers/b2evolution.inc.php
+++ b/include/admin/importers/b2evolution.inc.php
@@ -258,7 +258,7 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
         return true;
     }
 
-    function importCategories($parentid = 0, $new_parentid = 0, $b2db) {
+    function importCategories($parentid = 0, $new_parentid = 0, $b2db = null) {
         if (is_null($parentid)) {
             $where = 'WHERE ISNULL(cat_parent_ID)';
         } else {
diff --git a/include/admin/importers/lifetype.inc.php b/include/admin/importers/lifetype.inc.php
index 10a4c85c..30ee0ec2 100644
--- a/include/admin/importers/lifetype.inc.php
+++ b/include/admin/importers/lifetype.inc.php
@@ -265,7 +265,7 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
         return true;
     }
 
-    function importCategories($parentid = 0, $new_parentid = 0, $ltdb) {
+    function importCategories($parentid = 0, $new_parentid = 0, $ltdb = null) {
         if (is_null($parentid)) {
             $where = 'WHERE parent_id = 0';
         } else {
diff --git a/include/admin/importers/sunlog.inc.php b/include/admin/importers/sunlog.inc.php
index 03309d3c..15b12c84 100644
--- a/include/admin/importers/sunlog.inc.php
+++ b/include/admin/importers/sunlog.inc.php
@@ -240,7 +240,7 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
         return true;
     }
 
-    function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb) {
+    function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb = null) {
         $where = "WHERE parent = '" . mysqli_escape_string($parentid) . "'";
 
         $res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}categories
diff --git a/include/admin/importers/textpattern.inc.php b/include/admin/importers/textpattern.inc.php
index 73220eec..d53ef5af 100644
--- a/include/admin/importers/textpattern.inc.php
+++ b/include/admin/importers/textpattern.inc.php
@@ -218,7 +218,7 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
         return true;
     }
 
-    function importCategories($parentname = 'root', $parentid = 0, $txpdb) {
+    function importCategories($parentname = 'root', $parentid = 0, $txpdb = null) {
         $res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}txp_category
                                      WHERE parent = '" . mysqli_escape_string($parentname) . "' AND type = 'article'", $txpdb);
         if (!$res) {
diff --git a/include/admin/personal.inc.php b/include/admin/personal.inc.php
index fdcdb5ca..49c69b12 100644
--- a/include/admin/personal.inc.php
+++ b/include/admin/personal.inc.php
@@ -121,7 +121,7 @@ $data['config'] = serendipity_printConfigTemplate($template, $from, true, false)
 $add = array('internal' => true);
 serendipity_plugin_api::hook_event('backend_sidebar_entries_event_display_profiles', $from, $add);
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/admin/templates.inc.php b/include/admin/templates.inc.php
index 451b83e5..aa564fd9 100644
--- a/include/admin/templates.inc.php
+++ b/include/admin/templates.inc.php
@@ -36,7 +36,7 @@ class template_option
                                     WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
                                       AND name = '" . serendipity_db_escape_string($item) . "'");
 
-        if ($this->config[$item]['scope'] == 'global') {
+        if (($this->config[$item]['scope'] ?? '') == 'global') {
             serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                    WHERE okey = 't_global'
                                      AND name = '" . serendipity_db_escape_string($item) . "'");
diff --git a/include/admin/upgrader.inc.php b/include/admin/upgrader.inc.php
index 23efc5e0..895cb8b7 100644
--- a/include/admin/upgrader.inc.php
+++ b/include/admin/upgrader.inc.php
@@ -484,7 +484,7 @@ if (($showAbort && $serendipity['GET']['action'] == 'ignore') || $serendipity['G
 $data['get']['action'] = $serendipity['GET']['action']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
 $data['templatePath']  = $serendipity['templatePath'];
 
-if (!is_object($serendipity['smarty'])) {
+if (!is_object($serendipity['smarty'] ?? null)) {
     serendipity_smarty_init();
 }
 
diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php
index 05824b7e..40417308 100644
--- a/include/functions_config.inc.php
+++ b/include/functions_config.inc.php
@@ -359,8 +359,7 @@ function serendipity_logout() {
  * @return null
  */
 function serendipity_session_destroy() {
-    echo "session destroy";
-    $no_smarty = $_SESSION['no_smarty'];
+    $no_smarty = $_SESSION['no_smarty'] ?? null;
     @session_destroy();
     session_start();
     session_regenerate_id();
@@ -800,7 +799,7 @@ function serendipity_is_iframe() {
     global $serendipity;
 
     if ($serendipity['GET']['is_iframe'] ?? false && is_array($_SESSION['save_entry'])) {
-        if (!is_object($serendipity['smarty'])) {
+        if (!is_object($serendipity['smarty'] ?? null)) {
             // We need smarty also in the iframe to load a template's config.inc.php and register possible event hooks.
             serendipity_smarty_init();
         }
diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php
index ed6ff026..78e15df2 100644
--- a/include/functions_entries.inc.php
+++ b/include/functions_entries.inc.php
@@ -41,7 +41,7 @@ function serendipity_fetchCategoryRange($categoryid) {
         $res = array(array('category_left' => 0, 'category_right' => 0));
     }
 
-    if ($res[0]['hide_sub'] == 1) {
+    if (($res[0]['hide_sub'] ?? null) == 1) {
         // Set ranges only to own category. Patch by netmorix
         return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_left']);
     } else {
@@ -354,6 +354,9 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
     }
 
     serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('noCache' => $noCache, 'noSticky' => $noSticky, 'source' => 'entries'));
+    if (!isset($cond['addkey'])) {
+        $cond['addkey'] = '';
+    }
 
     if (is_null($select_key)) {
         $select_key = "{$cond['distinct']}
@@ -394,6 +397,12 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
                         ON ec.categoryid = c.categoryid";
     }
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
+    if (!isset($cond['and'])) {
+        $cond['and'] = '';
+    }
     if ($joinown) {
         $cond['joins'] .= $joinown;
     }
@@ -587,6 +596,9 @@ function &serendipity_fetchEntry($key, $val, $full = true, $fetchDrafts = 'false
         $cond['single_orderby'] = '';
     }
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
     $querystring = "SELECT  e.id,
                             e.title,
                             e.timestamp,
@@ -894,6 +906,12 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
     serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('source' => 'search', 'term' => $term));
     serendipity_ACL_SQL($cond, 'limited');
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
+    if (!isset($cond['addkey'])) {
+        $cond['addkey'] = '';
+    }
     $serendipity['fullCountQuery'] = "
                       FROM
                             {$serendipity['dbPrefix']}entries e
@@ -1078,7 +1096,7 @@ function serendipity_getTotalEntries() {
 function serendipity_printEntries($entries, $extended = 0, $preview = false, $smarty_block = 'ENTRIES', $smarty_fetch = true, $use_hooks = true, $use_footer = true, $use_grouped_array = false) {
     global $serendipity;
 
-    if (!is_object($serendipity['smarty'])) {
+    if (!is_object($serendipity['smarty'] ?? null)) {
         serendipity_smarty_init(); // if not set, start Smarty templating to avoid member function "method()" on a non-object errors (was draft preview error, now at line 1239)
     }
     
@@ -1113,17 +1131,22 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
     if ($use_grouped_array === false) {
         // Use grouping by date (default)
         $dategroup = array();
-        for ($x = 0, $num_entries = count($entries); $x < $num_entries; $x++) {
-            if (!empty($entries[$x]['properties']['ep_is_sticky']) && serendipity_db_bool($entries[$x]['properties']['ep_is_sticky'])) {
-                $entries[$x]['is_sticky'] = true;
-                $key = 'sticky';
-            } else {
-                $key = date('Ymd', serendipity_serverOffsetHour($entries[$x]['timestamp']));
-            }
+        $num_entries = count($entries);
+        foreach ($entries as $i => &$entry) {
+            if ($i !== 'id') {
+                if (!empty($entry['properties']['ep_is_sticky']) && serendipity_db_bool($entry['properties']['ep_is_sticky'])) {
+                    $entry['is_sticky'] = true;
+                    $key = 'sticky';
+                } else {
+                    $key = date('Ymd', serendipity_serverOffsetHour($entry['timestamp']));
+                }
 
-            $dategroup[$key]['date']        = $entries[$x]['timestamp'];
-            $dategroup[$key]['is_sticky']   = (isset($entries[$x]['is_sticky']) && (serendipity_db_bool($entries[$x]['is_sticky']) ? true : false));
-            $dategroup[$key]['entries'][]   = &$entries[$x];
+                $dategroup[$key]['date']        = $entry['timestamp'];
+                $dategroup[$key]['is_sticky']   = (isset($entry['is_sticky']) && (serendipity_db_bool($entry['is_sticky']) ? true : false));
+                $dategroup[$key]['entries'][]   = &$entry;
+            } else {
+                $num_entries--;
+            }
         }
     } elseif ($use_grouped_array === 'plugin') {
         // Let a plugin do the grouping
@@ -1144,7 +1167,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
             }
 
             if (!empty($entry['properties']['ep_cache_body'])) {
-                $entry['pre_body']  = $entry['body'];
+                $entry['pre_body']  = $entry['body'] ?? null;
                 $entry['body']      = &$entry['properties']['ep_cache_body'];
                 $entry['is_cached'] = true;
             }
@@ -1160,7 +1183,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
             }
 
             if (!empty($entry['properties']['ep_cache_extended'])) {
-                $entry['pre_extended']  = $entry['extended'];
+                $entry['pre_extended']  = $entry['extended'] ?? null;
                 $entry['extended']  = &$entry['properties']['ep_cache_extended'];
                 $entry['is_cached'] = true;
             }
@@ -1721,7 +1744,7 @@ function serendipity_printArchives() {
               ON e.id = ec.entryid
        LEFT JOIN {$serendipity['dbPrefix']}category c
               ON ec.categoryid = c.categoryid" : "") . 
-              $sql_condition['joins'] .
+              ($sql_condition['joins'] ?? '') .
         " WHERE isdraft = 'false'"
                 . ($sql_condition['and'] ?? '')
                 . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND timestamp <= " . serendipity_db_time() : '')
diff --git a/include/functions_entries_admin.inc.php b/include/functions_entries_admin.inc.php
index ff0bd2d9..7b6a4cd8 100644
--- a/include/functions_entries_admin.inc.php
+++ b/include/functions_entries_admin.inc.php
@@ -158,7 +158,7 @@ function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = arr
 
     $template_vars['entry_template'] = serendipity_getTemplateFile('admin/entries.tpl', 'serendipityPath');
 
-    if (!is_object($serendipity['smarty'])) {
+    if (!is_object($serendipity['smarty'] ?? null)) {
         serendipity_smarty_init();
     }
     $serendipity['smarty']->registerPlugin('modifier', 'emit_htmlarea_code', 'serendipity_emit_htmlarea_code');
diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php
index 4fb8c864..a4026ee6 100644
--- a/include/functions_images.inc.php
+++ b/include/functions_images.inc.php
@@ -107,13 +107,12 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
         $cond['parts']['keywords'] = " AND (mk.property IN ('" . serendipity_db_implode("', '", $keywords, 'string') . "'))\n";
         $cond['joinparts']['keywords'] = true;
     }
+    $cond['parts']['filter'] = '';
     foreach($filter AS $f => $fval) {
         if (! (isset($orderfields[$f]) || $f == "fileCategory") || empty($fval)) {
             continue;
         }
-        
-        $cond['parts']['filter'] = '';
-        
+
         if (is_array($fval)) {
             if (empty($fval['from']) || empty($fval['to'])) {
                 continue;
@@ -187,6 +186,9 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
         $cond['orderkey'] = "''";
     }
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
     if ($cond['joinparts']['properties'] ?? false) {
         $cond['joins'] .= "\n LEFT OUTER JOIN {$serendipity['dbPrefix']}mediaproperties AS bp
                                         ON (bp.mediaid = i.id AND bp.property_group = 'base_property' AND bp.property = '{$cond['orderproperty']}')\n";
@@ -211,6 +213,9 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
         $cond['distinct'] = '';
     }
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
     $basequery = "FROM {$serendipity['dbPrefix']}images AS i
        LEFT OUTER JOIN {$serendipity['dbPrefix']}authors AS a
                     ON i.authorid = a.authorid
@@ -283,6 +288,9 @@ function serendipity_fetchImageFromDatabase($id, $mode = 'read') {
         serendipity_ACL_SQL($cond, false, 'directory', $mode);
     }
 
+    if (!isset($cond['joins'])) {
+        $cond['joins'] = '';
+    }
     $rs = serendipity_db_query("SELECT {$cond['distinct']} i.id, i.name, i.extension, i.mime, i.size, i.dimensions_width, i.dimensions_height, i.date, i.thumbnail_name, i.authorid, i.path, i.hotlink, i.realname
                                   FROM {$serendipity['dbPrefix']}images AS i
                                        {$cond['joins']}
@@ -409,7 +417,7 @@ function serendipity_deleteImage($id) {
                     $dfnThumb = $file['path'] . $file['name'] . (!empty($thumb['fthumb']) ? '.' . $thumb['fthumb'] : '') . (empty($file['extension']) ? '' : '.' . $file['extension']);
                     $dfThumb  = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $dfnThumb;
 
-                    if (@unlink($dfThumb)) {
+                    if (file_exists($dfThumb) && @unlink($dfThumb)) {
                         $messages .= sprintf('<span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> ' . DELETE_THUMBNAIL . "</span>\n", $dfnThumb);
                     }
                 }
@@ -1233,6 +1241,9 @@ function serendipity_syncThumbs($deleteThumbs = false) {
                             AND extension = '" . serendipity_db_escape_string($f[1]) . "'"
         );
         serendipity_ACL_SQL($cond, false, 'directory');
+        if (!isset($cond['joins'])) {
+            $cond['joins'] = '';
+        }
 
         $rs = serendipity_db_query("SELECT *
                                       FROM {$serendipity['dbPrefix']}images AS i
@@ -3202,8 +3213,8 @@ function serendipity_prepareMedia(&$file, $url = '') {
 
     /* If it is an image, and the thumbnail exists */
     if ($file['is_image'] && file_exists($file['full_thumb'])) {
-        $file['thumbWidth']  = $file['dim'][0];
-        $file['thumbHeight'] = $file['dim'][1];
+        $file['thumbWidth']  = $file['dim'][0] ?? null;
+        $file['thumbHeight'] = $file['dim'][1] ?? null;
     } elseif ($file['is_image'] && $file['hotlink']) {
         $sizes = serendipity_calculate_aspect_size($file['dimensions_width'], $file['dimensions_height'], $serendipity['thumbSize'], $serendipity['thumbConstraint']);
         $file['thumbWidth']  = $sizes[0];
@@ -3265,7 +3276,7 @@ function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lin
         $form_hidden .=  '        <input type="hidden" name="serendipity[adminModule]" value="media">'."\n";
     }
 
-    if (!is_object($serendipity['smarty'])) {
+    if (!is_object($serendipity['smarty'] ?? null)) {
         serendipity_smarty_init();
     }
     $order_fields = serendipity_getImageFields();
diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php
index a5a77079..14f80e9a 100644
--- a/include/functions_plugins_admin.inc.php
+++ b/include/functions_plugins_admin.inc.php
@@ -497,7 +497,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
                 // I can't get it to work unless there's a class of
                 // pluginmanager_container on the ol, either.
                 // The drag-n-drop returns the list of IDs in order.
-                $data['sequencejs_output'] = $sequencejs_output = $serendipity['sequencejs_output'];
+                $data['sequencejs_output'] = $sequencejs_output = $serendipity['sequencejs_output'] ?? null;
                 if (!$sequencejs_output) {
                     $serendipity['sequencejs_output'] = true;
                 }
diff --git a/include/functions_routing.inc.php b/include/functions_routing.inc.php
index ed4b50c6..2383deb3 100644
--- a/include/functions_routing.inc.php
+++ b/include/functions_routing.inc.php
@@ -37,33 +37,35 @@ function locateHiddenVariables($_args) {
             continue;
         }
 
-        if ($v[0] == 'P') { /* Page */
-            $page = substr($v, 1);
-            if (is_numeric($page)) {
-                $serendipity['GET']['page'] = $page;
-                unset($_args[$k]);
-                unset($serendipity['uriArguments'][$k]);
-            }
-        } elseif ($v[0] == 'A') { /* Author */
-            $url_author = substr($v, 1);
-            if (is_numeric($url_author)) {
-                $serendipity['GET']['viewAuthor'] = (int)$url_author;
-                unset($_args[$k]);
-            }
-        } elseif ($v == 'summary') { /* Summary */
-            $serendipity['short_archives'] = true;
-            if (! array_key_exists('head_subtitle', $serendipity)) {
-                $serendipity['head_subtitle'] = '';
-            }
-            $serendipity['head_subtitle'] .= SUMMARY . ' - ';
-            unset($_args[$k]);
-        } elseif ($v[0] == 'C') { /* category */
-            $cat = substr($v, 1);
-            if (is_numeric($cat)) {
-                $serendipity['GET']['category'] = $cat;
-                unset($_args[$k]);
-            }
-        }
+        if (strlen($v) > 0) {
+             if ($v[0] == 'P') { /* Page */
+                 $page = substr($v, 1);
+                 if (is_numeric($page)) {
+                     $serendipity['GET']['page'] = $page;
+                     unset($_args[$k]);
+                     unset($serendipity['uriArguments'][$k]);
+                 }
+             } elseif ($v[0] == 'A') { /* Author */
+                 $url_author = substr($v, 1);
+                 if (is_numeric($url_author)) {
+                     $serendipity['GET']['viewAuthor'] = (int)$url_author;
+                     unset($_args[$k]);
+                 }
+             } elseif ($v == 'summary') { /* Summary */
+                 $serendipity['short_archives'] = true;
+                 if (! array_key_exists('head_subtitle', $serendipity)) {
+                     $serendipity['head_subtitle'] = '';
+                 }
+                 $serendipity['head_subtitle'] .= SUMMARY . ' - ';
+                 unset($_args[$k]);
+             } elseif ($v[0] == 'C') { /* category */
+                 $cat = substr($v, 1);
+                 if (is_numeric($cat)) {
+                     $serendipity['GET']['category'] = $cat;
+                     unset($_args[$k]);
+                 }
+             }
+         }
     }
     return $_args;
 }
@@ -396,14 +398,13 @@ function serveArchives() {
     $serendipity['view'] = 'archives';
 
     $_args = locateHiddenVariables($serendipity['uriArguments']);
-
     /* We must always *assume* that Year, Month and Day are the first 3 arguments */
-    $year = $_args[0] ?? null;
-    $month = $_args[1] ?? null;
-    $day = $_args[2] ?? null;
-    if ($year == "archives") {
-        unset($year);
-    }
+    $year = $_args[1] ?? null;
+    $month = $_args[2] ?? null;
+    $day = $_args[3] ?? null;
+    //if ($year == "archives") {
+    //    unset($year);
+    //}
 
     $serendipity['GET']['action']     = 'read';
     $serendipity['GET']['hidefooter'] = true;
@@ -473,10 +474,13 @@ function serveArchives() {
     $serendipity['range'] = array($ts, $te);
 
     if ($serendipity['GET']['action'] == 'read') {
-        if ($serendipity['GET']['category']) {
+        if ($serendipity['GET']['category'] ?? false) {
             $cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
             $serendipity['head_title'] = $cInfo['category_name'];
         }
+        if (!isset($serendipity['head_subtitle'])) {
+            $serendipity['head_subtitle'] = '';
+        }
         $serendipity['head_subtitle'] .= sprintf(ENTRIES_FOR, $date);
     }
 
diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php
index a93693ef..02d4df4a 100644
--- a/include/functions_smarty.inc.php
+++ b/include/functions_smarty.inc.php
@@ -284,19 +284,40 @@ function serendipity_smarty_fetchPrintEntries($params, $smarty) {
         $serendipity['short_archives'] = $params['short_archives'];
     }
 
-    $old_var['skip_smarty_hooks']     = $serendipity['skip_smarty_hooks'];
+    $old_var['skip_smarty_hooks']     = $serendipity['skip_smarty_hooks'] ?? null;
     $serendipity['skip_smarty_hooks'] = $params['skip_smarty_hooks'];
 
-    $old_var['skip_smarty_hook']     = $serendipity['skip_smarty_hook'];
+    $old_var['skip_smarty_hook']     = $serendipity['skip_smarty_hook'] ?? null;
     $serendipity['skip_smarty_hook'] = $params['skip_smarty_hook'];
 
     foreach($restore_var_GET_keys AS $key) {
         if (!empty($params[$key])) {
-            $old_var['GET'][$key]     = $serendipity['GET'][$key];
+            $old_var['GET'][$key]     = $serendipity['GET'][$key] ?? null;
             $serendipity['GET'][$key] = $params[$key];
         }
     }
 
+    $param_keys = array(
+        'full',
+        'limit',
+        'fetchDrafts',
+        'modified_since',
+        'orderby',
+        'filter_sql',
+        'noCache',
+        'noSticky',
+        'select_key',
+        'group_by',
+        'returncode',
+        'joinauthors',
+        'joincategories',
+        'joinown'
+    );
+    foreach ($param_keys as $param_key) {
+        if (!isset($params[$param_key])) {
+            $params[$param_key] = null;
+        }
+    }
     if (!empty($params['id'])) {
         $entry = serendipity_fetchEntry(
             'id',
@@ -366,7 +387,7 @@ function serendipity_smarty_fetchPrintEntries($params, $smarty) {
         $serendipity['short_archives'] = $old_var['short_archives'];
     }
 
-    if (is_array($old_var['GET'])) {
+    if (is_array($old_var['GET'] ?? null)) {
         foreach($old_var['GET'] AS $key => $val) {
             $serendipity['GET'][$key] = $val;
         }
@@ -917,7 +938,9 @@ function serendipity_smarty_init($vars = array()) {
             #@define('MEMCACHE_EXTENSION_LOADED', (class_exists('Memcached',false) || class_exists('Memcache',false)) && (extension_loaded("memcached") || extension_loaded("memcache")));
 
             // Default Smarty Engine will be used
-            @define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
+            if (!defined('SMARTY_DIR')) {
+                @define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
+            }
             if (!class_exists('Smarty')) {
                 include_once SMARTY_DIR . 'Smarty.class.php';
             }
diff --git a/include/lang.inc.php b/include/lang.inc.php
index f5573053..78e435b4 100644
--- a/include/lang.inc.php
+++ b/include/lang.inc.php
@@ -53,7 +53,7 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
     // Needs to be included here because we need access to constant LANG_CHARSET definied in languages (not available for compat.inc.php)
 
     if (function_exists('mb_language')) {
-        @mb_language($serendipity['lang']);
+        @mb_language('uni'); // TODO: test for non-unicode installations
     }
 
     if (function_exists('mb_internal_encoding')) {
diff --git a/plugins/serendipity_event_nl2br/Changelog b/plugins/serendipity_event_nl2br/Changelog
index f0efd5f6..d3af476a 100644
--- a/plugins/serendipity_event_nl2br/Changelog
+++ b/plugins/serendipity_event_nl2br/Changelog
@@ -1,3 +1,4 @@
+2.21.10: * hotfixes for PHP 8
 2.21.7: * add some newlines in output to make it better humanly readable
 2.21.6: * add missing 'u' inline element
 2.21.5: * nl2p: if the double newline contains spaces, e.g. \n \n, these
diff --git a/plugins/serendipity_event_nl2br/serendipity_event_nl2br.php b/plugins/serendipity_event_nl2br/serendipity_event_nl2br.php
index d4bd96d8..9cccd2e2 100644
--- a/plugins/serendipity_event_nl2br/serendipity_event_nl2br.php
+++ b/plugins/serendipity_event_nl2br/serendipity_event_nl2br.php
@@ -18,7 +18,7 @@ class serendipity_event_nl2br extends serendipity_event
         $propbag->add('description',   PLUGIN_EVENT_NL2BR_DESC);
         $propbag->add('stackable',     false);
         $propbag->add('author',        'Serendipity Team, Stephan Brunker');
-        $propbag->add('version',       '2.21.9');
+        $propbag->add('version',       '2.21.10');
         $propbag->add('requirements',  array(
             'serendipity' => '1.6',
             'smarty'      => '2.6.7',
@@ -344,7 +344,7 @@ class serendipity_event_nl2br extends serendipity_event
                     if( $isobr ) {
                         $serendipity['nl2br']['iso2br'] = true; // include to global as also used by staticpages now
 
-                        if (! array_key_exists('smarty', $serendipity) || !is_object($serendipity['smarty'])) {
+                        if (!is_object($serendipity['smarty'] ?? null)) {
                             serendipity_smarty_init(); // if not set to avoid member function assign() on a non-object error, start Smarty templating
                         }
 
diff --git a/plugins/serendipity_event_xhtmlcleanup/Changelog b/plugins/serendipity_event_xhtmlcleanup/Changelog
new file mode 100644
index 00000000..c2942504
--- /dev/null
+++ b/plugins/serendipity_event_xhtmlcleanup/Changelog
@@ -0,0 +1,5 @@
+1.8.1:
+---
+* hotfixes for PHP 8
+
+
diff --git a/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php b/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php
index 3246e150..650cf1c6 100644
--- a/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php
+++ b/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php
@@ -19,7 +19,7 @@ class serendipity_event_xhtmlcleanup extends serendipity_event
         $propbag->add('description',   PLUGIN_EVENT_XHTMLCLEANUP_DESC);
         $propbag->add('stackable',     false);
         $propbag->add('author',        'Garvin Hicking');
-        $propbag->add('version',       '1.8');
+        $propbag->add('version',       '1.8.1');
         $propbag->add('requirements',  array(
             'serendipity' => '1.6',
             'smarty'      => '2.6.7',
@@ -143,7 +143,7 @@ class serendipity_event_xhtmlcleanup extends serendipity_event
                     $this->cleanup_parse = serendipity_db_bool($this->get_config('xhtml_parse', 'true'));
                     foreach ($this->markup_elements as $temp) {
                         if (serendipity_db_bool($this->get_config($temp['name'], 'true')) && isset($eventData[$temp['element']]) &&
-                            !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+                            (isset($eventData['properties']) && isset($eventData['properties']['ep_disable_markup_' . $this->instance]) && !$eventData['properties']['ep_disable_markup_' . $this->instance]) &&
                             !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
                             $element = $temp['element'];
                             $this->cleanup_tag      = 'IMG';
diff --git a/plugins/serendipity_plugin_comments/ChangeLog b/plugins/serendipity_plugin_comments/ChangeLog
index 5bf3126a..90eb424b 100644
--- a/plugins/serendipity_plugin_comments/ChangeLog
+++ b/plugins/serendipity_plugin_comments/ChangeLog
@@ -1,8 +1,13 @@
+Version 1.17.1:
+------------------------------------------------------------------------
+* Fix: hotfixes for PHP 8
+
 Version 1.17:
 ------------------------------------------------------------------------
 * Fix: Don't strip HTML tags from comment body before truncating if 
        serendipity_event_unstrip_tags is active, so it may actually
        preserve the tags (and replace them with entities).
+
 Version 1.16:
 ------------------------------------------------------------------------
 * Fix: wordwrap at word boundaries instead of "truncating" the lines
diff --git a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php
index 657005db..d45a9613 100644
--- a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php
+++ b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php
@@ -20,7 +20,7 @@ class serendipity_plugin_comments extends serendipity_plugin
         $propbag->add('description',   PLUGIN_COMMENTS_BLAHBLAH);
         $propbag->add('stackable',     true);
         $propbag->add('author',        'Garvin Hicking, Tadashi Jokagi, Judebert, G. Brockhaus');
-        $propbag->add('version',       '1.17');
+        $propbag->add('version',       '1.17.1');
         $propbag->add('requirements',  array(
             'serendipity' => '1.6',
             'smarty'      => '2.6.7',
@@ -166,6 +166,9 @@ class serendipity_plugin_comments extends serendipity_plugin
             serendipity_ACL_SQL($cond, true);
             serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('source' => 'entries'));
         }
+        if (!isset($cond['joins'])) {
+            $cond['joins'] = '';
+        }
 
         $q = 'SELECT    co.body              AS comment,
                         co.timestamp         AS stamp,
diff --git a/serendipity_admin.php b/serendipity_admin.php
index 46d279d4..8987bd90 100644
--- a/serendipity_admin.php
+++ b/serendipity_admin.php
@@ -244,7 +244,7 @@ if ($ajax) {
         $admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, '', '');
     }
 
-    if (!is_object($serendipity['smarty'])) {
+    if (!is_object($serendipity['smarty'] ?? null)) {
         serendipity_smarty_init();
     }
     $serendipity['smarty']->assignByRef('admin_vars', $admin_vars);
diff --git a/templates/2k11/admin/category.inc.tpl b/templates/2k11/admin/category.inc.tpl
index 413e2c64..58a06ce2 100644
--- a/templates/2k11/admin/category.inc.tpl
+++ b/templates/2k11/admin/category.inc.tpl
@@ -17,7 +17,7 @@
 {/if}
 {if $doDelete}
   {if $deleteSuccess}
-        <span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> {if $remainingCat}{$CONST.CATEGORY_DELETED_ARTICLES_MOVED|sprintf:$remainingCat:$cid}{else}{$cid|string_format:"{$CONST.CATEGORY_DELETED}"}{/if}</span>
+        <span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> {if isset($remainingCat) && $remainingCat}{$CONST.CATEGORY_DELETED_ARTICLES_MOVED|sprintf:$remainingCat:$cid}{else}{$cid|string_format:"{$CONST.CATEGORY_DELETED}"}{/if}</span>
   {else}
         <span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> {$CONST.INVALID_CATEGORY}</span>
   {/if}
@@ -74,7 +74,7 @@
                         <option value="0"{if $cid == 0} selected{/if}>{$CONST.NO_CATEGORY}</option>
                     {foreach $categories as $cat}
                         {if $cat.categoryid == $cid}{continue}{/if}
-                        <option value="{$cat.categoryid}"{if $this_cat.parentid == $cat.categoryid} selected{/if}>{for $i=1 to $cat.depth}&nbsp{/for} {$cat.category_name|escape}</option>
+                        <option value="{$cat.categoryid}"{if isset($this_cat.parentid) && $this_cat.parentid == $cat.categoryid} selected{/if}>{for $i=1 to $cat.depth}&nbsp{/for} {$cat.category_name|escape}</option>
                     {/foreach}
                     </select>
                 </div>
diff --git a/templates/2k11/admin/comments.inc.tpl b/templates/2k11/admin/comments.inc.tpl
index 192ae1ba..6d5b525c 100644
--- a/templates/2k11/admin/comments.inc.tpl
+++ b/templates/2k11/admin/comments.inc.tpl
@@ -133,7 +133,7 @@
                                 <dt>{$CONST.AUTHOR}:</dt>
                                 <dd>{$comment.author|escape|truncate:40:"&hellip;"} {$comment.action_author}</dd>
                                 <dt>{$CONST.EMAIL}:</dt>
-                                <dd>{if empty($comment.email)}N/A{else}<a href="mailto:{$comment.email|escape}" title="{$comment.email|escape}">{$comment.email|escape|truncate:40:"&hellip;"}</a>{if $comment.subscribed == 'true'} <i>({$CONST.ACTIVE_COMMENT_SUBSCRIPTION})</i>{/if}{/if} {$comment.action_email}</dd>
+                                <dd>{if empty($comment.email)}N/A{else}<a href="mailto:{$comment.email|escape}" title="{$comment.email|escape}">{$comment.email|escape|truncate:40:"&hellip;"}</a>{if $comment.subscribed == 'true'} <i>({$CONST.ACTIVE_COMMENT_SUBSCRIPTION})</i>{/if}{/if} {if isset($comment.action_email)}{$comment.action_email}{/if}</dd>
                                 <dt>IP:</dt>
                                 <dd>{if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {if isset($comment.action_ip)}{$comment.action_ip}{/if}</dd>
                                 <dt>URL:</dt>
@@ -189,4 +189,4 @@
             </div>
         </form>
     {/if}
-{/if}
\ No newline at end of file
+{/if}
diff --git a/templates/2k11/admin/configuration.inc.tpl b/templates/2k11/admin/configuration.inc.tpl
index d15cc933..a759db59 100644
--- a/templates/2k11/admin/configuration.inc.tpl
+++ b/templates/2k11/admin/configuration.inc.tpl
@@ -1,12 +1,12 @@
 <h2>{$CONST.CONFIGURATION}</h2>
 {if $installAction == 'check'}
-    {if $diagnosticError}
+    {if isset($diagnosticError) && $diagnosticError}
             <h2>{$CONST.DIAGNOSTIC_ERROR}</h2>
         {foreach $res as $r}
             <span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> {$r}</span>
         {/foreach}
     {else}
-        {if $htaccessRewrite}
+        {if isset($htaccessRewrite) && $htaccessRewrite}
             <h2>{$CONST.ATTEMPT_WRITE_FILE|sprintf:"{$serendipityPath}htaccess"}</h2>
             {if is_array($res)}
                 {foreach $res as $r}
@@ -19,4 +19,4 @@
         <span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> {$CONST.WRITTEN_N_SAVED}</span>
     {/if}
 {/if}
-{$config}
\ No newline at end of file
+{$config}
diff --git a/templates/2k11/admin/media_items.tpl b/templates/2k11/admin/media_items.tpl
index b3875a89..f8efe1e4 100644
--- a/templates/2k11/admin/media_items.tpl
+++ b/templates/2k11/admin/media_items.tpl
@@ -15,7 +15,7 @@
                 {$img_alt="{$file.realname}"}
                 
             {elseif $file.is_image AND $file.hotlink}
-                {if $media.textarea}
+                {if (isset($media.textarea) && $media.textarea)}
                     {$link="?serendipity[adminModule]=images&amp;serendipity[adminAction]=choose&amp;serendipity[fid]={$file.id}&amp;serendipity[textarea]={$media.textarea}&amp;serendipity[noBanner]=true&amp;serendipity[noSidebar]=true&amp;serendipity[noFooter]=true&amp;serendipity[filename_only]={$media.filename_only}&amp;serendipity[htmltarget]={$media.htmltarget}"}
                 {else}
                     {if $file.url}
@@ -26,7 +26,7 @@
                     {$img_title="{$file.path}"}
                     {$img_alt="{$file.realname}"}
             {else}
-                {if $media.textarea}
+                {if (isset($media.textarea) && $media.textarea)}
                     {$link="?serendipity[adminModule]=images&amp;serendipity[adminAction]=choose&amp;serendipity[fid]={$file.id}&amp;serendipity[textarea]={$media.textarea}&amp;serendipity[noBanner]=true&amp;serendipity[noSidebar]=true&amp;serendipity[noFooter]=true&amp;serendipity[filename_only]={$media.filename_only}&amp;serendipity[htmltarget]={$media.htmltarget}"}
                 {else}
                     {if $file.url}
diff --git a/templates/2k11/admin/media_pane.tpl b/templates/2k11/admin/media_pane.tpl
index 554312e9..11057821 100644
--- a/templates/2k11/admin/media_pane.tpl
+++ b/templates/2k11/admin/media_pane.tpl
@@ -50,46 +50,52 @@
             {foreach $media.sort_order AS $filtername => $filter}
 
                 <div class="{cycle values="left,center,right"}{if $filter@iteration > 6} bp_filters{/if}">
-                {if $filter.type == 'date' || $filter.type == 'intrange'}
+                {if isset($filter.type) && ($filter.type == 'date' || $filter.type == 'intrange')}
 
                     <fieldset>
                         <span class="wrap_legend"><legend>{$filter.desc}</legend></span>
                 {else}
 
-                    <div class="form_{if $filter.type == 'authors'}select{else}field{/if}">
+                    <div class="form_{if isset($filter.type) && $filter.type == 'authors'}select{else}field{/if}">
                         <label for="serendipity_filter_{$filter@key}">{$filter.desc}</label>
                 {/if}
-                {if $filter.type == 'date'}
+                {if isset($filter.type)}
+                     {if $filter.type == 'date'}
 
-                        <div class="form_field">
-                            <label for="serendipity_filter_{$filter@key}_from" class="range-label">{$CONST.RANGE_FROM|lower}</label>
-                            <input id="serendipity_filter_{$filter@key}_from" name="serendipity[filter][{$filter@key}][from]" type="date" placeholder="2001-01-31" value="{if isset($media.filter[$filter@key].from)}{$media.filter[$filter@key].from|escape}{/if}">
-                            <label for="serendipity_filter_{$filter@key}_to" class="range-label">{$CONST.RANGE_TO|lower}</label>
-                            <input id="serendipity_filter_{$filter@key}_to" name="serendipity[filter][{$filter@key}][to]" type="date" placeholder="2005-12-31" value="{if isset($media.filter[$filter@key].to)}{$media.filter[$filter@key].to|escape}{/if}">
-                        </div>
-                {elseif $filter.type == 'intrange'}
+                             <div class="form_field">
+                                 <label for="serendipity_filter_{$filter@key}_from" class="range-label">{$CONST.RANGE_FROM|lower}</label>
+                                 <input id="serendipity_filter_{$filter@key}_from" name="serendipity[filter][{$filter@key}][from]" type="date" placeholder="2001-01-31" value="{if isset($media.filter[$filter@key].from)}{$media.filter[$filter@key].from|escape}{/if}">
+                                 <label for="serendipity_filter_{$filter@key}_to" class="range-label">{$CONST.RANGE_TO|lower}</label>
+                                 <input id="serendipity_filter_{$filter@key}_to" name="serendipity[filter][{$filter@key}][to]" type="date" placeholder="2005-12-31" value="{if isset($media.filter[$filter@key].to)}{$media.filter[$filter@key].to|escape}{/if}">
+                             </div>
+                     {elseif $filter.type == 'intrange'}
 
-                        <div class="form_field">
-                            <label for="serendipity_filter_{$filter@key}_from" class="range-label">{$CONST.RANGE_FROM|lower}</label>
-                            <input id="serendipity_filter_{$filter@key}_from" name="serendipity[filter][{$filter@key}][from]" type="text" placeholder="{if $filtername == 'bp.RUN_LENGTH'}in{/if}" value="{if isset($media.filter[$filter@key].from)}{$media.filter[$filter@key].from|escape}{/if}">
-                            <label for="serendipity_filter_{$filter@key}_to" class="range-label">{$CONST.RANGE_TO|lower}</label>
-                            <input id="serendipity_filter_{$filter@key}_to" name="serendipity[filter][{$filter@key}][to]" type="text" placeholder="{if $filtername == 'bp.RUN_LENGTH'}seconds{/if}" value="{if isset($media.filter[$filter@key].to)}{$media.filter[$filter@key].to|escape}{/if}">
-                        </div>
-                {elseif $filter.type == 'authors'}
+                             <div class="form_field">
+                                 <label for="serendipity_filter_{$filter@key}_from" class="range-label">{$CONST.RANGE_FROM|lower}</label>
+                                 <input id="serendipity_filter_{$filter@key}_from" name="serendipity[filter][{$filter@key}][from]" type="text" placeholder="{if $filtername == 'bp.RUN_LENGTH'}in{/if}" value="{if isset($media.filter[$filter@key].from)}{$media.filter[$filter@key].from|escape}{/if}">
+                                 <label for="serendipity_filter_{$filter@key}_to" class="range-label">{$CONST.RANGE_TO|lower}</label>
+                                 <input id="serendipity_filter_{$filter@key}_to" name="serendipity[filter][{$filter@key}][to]" type="text" placeholder="{if $filtername == 'bp.RUN_LENGTH'}seconds{/if}" value="{if isset($media.filter[$filter@key].to)}{$media.filter[$filter@key].to|escape}{/if}">
+                             </div>
+                     {elseif $filter.type == 'authors'}
 
-                        <select id="serendipity_filter_{$filter@key}" name="serendipity[filter][{$filter@key}]">
-                            <option value="">{$CONST.ALL_AUTHORS}</option>
-                            {foreach $media.authors AS $media_author}
+                             <select id="serendipity_filter_{$filter@key}" name="serendipity[filter][{$filter@key}]">
+                                 <option value="">{$CONST.ALL_AUTHORS}</option>
+                                 {foreach $media.authors AS $media_author}
 
-                            <option value="{$media_author.authorid}"{if isset($media.filter[$filter@key]) and $media.filter[$filter@key] == $media_author.authorid} selected{/if}>{$media_author.realname|escape}</option>
-                            {/foreach}
+                                 <option value="{$media_author.authorid}"{if isset($media.filter[$filter@key]) and $media.filter[$filter@key] == $media_author.authorid} selected{/if}>{$media_author.realname|escape}</option>
+                                 {/foreach}
 
-                        </select>
+                             </select>
+                     {else}{* this is of type string w/o being named *}
+                             {* label is already set on loop start, when type is not date or intrange *}
+                             <input id="serendipity_filter_{$filter@key}" name="serendipity[filter][{$filter@key}]" type="text" value="{if isset($media.filter[$filter@key])}{$media.filter[$filter@key]|escape}{/if}">
+                     {/if}
                 {else}{* this is of type string w/o being named *}
                         {* label is already set on loop start, when type is not date or intrange *}
                         <input id="serendipity_filter_{$filter@key}" name="serendipity[filter][{$filter@key}]" type="text" value="{if isset($media.filter[$filter@key])}{$media.filter[$filter@key]|escape}{/if}">
                 {/if}
-                {if $filter.type == 'date' || $filter.type == 'intrange'}
+                
+                {if isset($filter.type) && ($filter.type == 'date' || $filter.type == 'intrange')}
 
                     </fieldset>
                 {else}
diff --git a/templates/2k11/entries.tpl b/templates/2k11/entries.tpl
index 848deaf4..3284451a 100644
--- a/templates/2k11/entries.tpl
+++ b/templates/2k11/entries.tpl
@@ -1,4 +1,5 @@
 {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
+{if isset($entries)}
 {foreach from=$entries item="dategroup"}
     {foreach from=$dategroup.entries item="entry"}
     {assign var="entry" value=$entry scope="parent"}
@@ -137,6 +138,11 @@
     <p class="nocontent">{$CONST.NO_ENTRIES_TO_PRINT}</p>
     {/if}
 {/foreach}
+{else}
+    {if isset($plugin_clean_page) and not $plugin_clean_page}
+    <p class="nocontent">{$CONST.NO_ENTRIES_TO_PRINT}</p>
+    {/if}
+{/if}
 {if isset($footer_info) and $footer_info or isset($footer_prev_page) and $footer_prev_page or isset($footer_next_page) and $footer_next_page}
     <nav class="serendipity_pagination block_level">
         <h2 class="visuallyhidden">{$CONST.TWOK11_PAG_TITLE}</h2>
@@ -150,4 +156,4 @@
         </ul>
     </nav>
 {/if}
-    {serendipity_hookPlugin hook="entries_footer"}
\ No newline at end of file
+    {serendipity_hookPlugin hook="entries_footer"}