diff --git a/lib/classes/librarysearch/LibraryDocument.class.php b/lib/classes/librarysearch/LibraryDocument.class.php
index 4a3d1f01dd4ae378c6b8a4101e7a3278553c2549..4c90e0b4595450e1dcd24cfe7af05cde5b113042 100644
--- a/lib/classes/librarysearch/LibraryDocument.class.php
+++ b/lib/classes/librarysearch/LibraryDocument.class.php
@@ -121,7 +121,7 @@ class LibraryDocument
     {
         if ($format == 'long') {
             $long_title = '';
-            if ($this->csl_data['issued'] && $this->csl_data['author']) {
+            if (isset($this->csl_data['issued'], $this->csl_data['author'])) {
                 $first_author_last_name = $this->csl_data['author'][0]['family'];
                 $year = $this->getIssueDate(true);
                 if ($year) {
@@ -129,11 +129,11 @@ class LibraryDocument
                 } else {
                     $long_title = sprintf('%s - ', $first_author_last_name);
                 }
-            } elseif ($this->csl_data['author']) {
+            } elseif (isset($this->csl_data['author'])) {
                 $first_author_last_name = $this->csl_data['author'][0]['family'];
                 $long_title = sprintf('%s - ', $first_author_last_name);
             }
-            $long_title .= $this->csl_data['title'];
+            $long_title .= $this->csl_data['title'] ?? '';
             return $long_title;
         } elseif ($format == 'long-comma') {
             $data = [];
@@ -142,13 +142,13 @@ class LibraryDocument
             if ($first_author_last_name) {
                 $data[] = $first_author_last_name;
             }
-            $data[] = $this->csl_data['title'];
+            $data[] = $this->csl_data['title'] ?? '';
             if ($year) {
                 $data[] = $year;
             }
             return implode(', ', $data);
         } else {
-            return $this->csl_data['title'] ? $this->csl_data['title'] : '';
+            return $this->csl_data['title'] ?? '';
         }
     }
 
@@ -158,7 +158,7 @@ class LibraryDocument
      */
     public function getAuthorNames(): string
     {
-        if (!$this->csl_data['author']) {
+        if (empty($this->csl_data['author'])) {
             return '';
         }
 
@@ -411,22 +411,22 @@ class LibraryDocument
     public function getSearchDescription()
     {
         $description = [];
-        if ($this->search_params[LibrarySearch::AUTHOR]) {
+        if (isset($this->search_params[LibrarySearch::AUTHOR])) {
             $description[] = sprintf(_('Autor: „%s“'), $this->search_params[LibrarySearch::AUTHOR]);
         }
-        if ($this->search_params[LibrarySearch::YEAR]) {
+        if (isset($this->search_params[LibrarySearch::YEAR])) {
             $description[] = sprintf(_('Jahr: „%s“'), $this->search_params[LibrarySearch::YEAR]);
         }
-        if ($this->search_params[LibrarySearch::TITLE]) {
+        if (isset($this->search_params[LibrarySearch::TITLE])) {
             $description[] = sprintf(_('Titel: „%s“'), $this->search_params[LibrarySearch::TITLE]);
         }
-        if ($this->search_params[LibrarySearch::NUMBER]) {
+        if (isset($this->search_params[LibrarySearch::NUMBER])) {
             $description[] = sprintf(_('Nummer: „%s“'), $this->search_params[LibrarySearch::NUMBER]);
         }
-        if ($this->search_params[LibrarySearch::PUBLICATION]) {
+        if (isset($this->search_params[LibrarySearch::PUBLICATION])) {
             $description[] = sprintf(_('Zeitschrift: „%s“'), $this->search_params[LibrarySearch::PUBLICATION]);
         }
-        if ($this->search_params[LibrarySearch::SIGNATURE]) {
+        if (isset($this->search_params[LibrarySearch::SIGNATURE])) {
             $description[] = sprintf(_('Signatur: „%s“'), $this->search_params[LibrarySearch::SIGNATURE]);
         }
         return $description;
diff --git a/lib/filesystem/FileManager.php b/lib/filesystem/FileManager.php
index a958c61127d8047f49676468e52392da1d66a2b6..bfa40424e3275ea041bf67cc046c5a51bb20fe11 100644
--- a/lib/filesystem/FileManager.php
+++ b/lib/filesystem/FileManager.php
@@ -111,9 +111,11 @@ class FileManager
             return 'file-generic';
         }
 
-        list($category, $type) = explode('/', $mime_type, 2);
+        $chunks = explode('/', $mime_type, 2);
+        $category = $chunks[0];
+        $type = $chunks[1] ?? null;
 
-        switch($category) {
+        switch ($category) {
             case 'image':
                 return 'file-pic';
             case 'audio':
diff --git a/lib/models/User.class.php b/lib/models/User.class.php
index 98abd45caef46338dfa631c5faeffc5f396d78f4..8219fa7dafca59824075cdc790df9ccd9909c1f9 100644
--- a/lib/models/User.class.php
+++ b/lib/models/User.class.php
@@ -67,6 +67,7 @@
  * @property UserInfo   info   has_one UserInfo
  * @property UserOnline online has_one UserOnline
  * @property Kategorie[]|SimpleORMapCollection $profile_categories has_many Kategorie
+ * @property UserDomain[]|SimpleORMapCollection $domains
  *
  * @property UserConfig config
  */
diff --git a/lib/user_visible.inc.php b/lib/user_visible.inc.php
index 0706b3257736b2606d6399241c3972476b240266..c6b56860cd6978de856172d2f46e699daa16ebda 100644
--- a/lib/user_visible.inc.php
+++ b/lib/user_visible.inc.php
@@ -82,8 +82,13 @@ function get_visibility_by_state ($state, $user_id) {
         return true;
     }
 
+    $other_user = User::find($user_id);
+    if (!$other_user) {
+        return false;
+    }
+
     $same_domain = UserDomain::checkUserVisibility(
-        User::find($user_id)->domains,
+        $other_user->domains,
         User::findCurrent()->domains
     );