From a92b099853842464c5561260ebcd688ceaf300c9 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Sat, 6 Jul 2024 06:43:47 +0000
Subject: [PATCH] prevent php8 warnings, fixes #4369

Closes #4369

Merge request studip/studip!3168
---
 app/views/materialien/files/index.php | 2 +-
 lib/models/MvvFile.php                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/views/materialien/files/index.php b/app/views/materialien/files/index.php
index 1b00cec3d4d..538d97a38c0 100644
--- a/app/views/materialien/files/index.php
+++ b/app/views/materialien/files/index.php
@@ -109,7 +109,7 @@
                 $pagination->set_attribute('num_postings', $count);
                 $pagination->set_attribute('page', $page);
                 // ARGH!
-                $page_link = reset(explode('?', $controller->action_url('index'))) . '?page_files=%s';
+                $page_link = explode('?', $controller->action_url('index'))[0] . '?page_files=%s';
                 $pagination->set_attribute('pagelink', $page_link);
                 echo $pagination->render("shared/pagechooser");
                 ?>
diff --git a/lib/models/MvvFile.php b/lib/models/MvvFile.php
index 44d908e349c..e3c0e3cd8d5 100644
--- a/lib/models/MvvFile.php
+++ b/lib/models/MvvFile.php
@@ -92,7 +92,7 @@ class MvvFile extends ModuleManagementModel
      */
     public function getRangeType()
     {
-        if ($this->ranges) {
+        if (count($this->ranges) > 0) {
             return $this->ranges[0]->range_type;
         }
         return '';
-- 
GitLab