Code Duplication    Length = 5-6 lines in 5 locations

main/exercise/exercise.class.php 1 location

@@ 603-607 (lines=5) @@
600
601
            $limitCondition = null;
602
603
            if (isset($start) && isset($limit)) {
604
                $start = intval($start);
605
                $limit = intval($limit);
606
                $limitCondition = " LIMIT $start, $limit";
607
            }
608
            $sql .= $limitCondition;
609
            $result = Database::query($sql);
610
            $questions = array();

main/inc/lib/sessionmanager.lib.php 1 location

@@ 3479-3483 (lines=5) @@
3476
            return $row['count'];
3477
        }
3478
3479
        if (isset($from) && isset($limit)) {
3480
            $from = intval($from);
3481
            $limit = intval($limit);
3482
            $sql .= " LIMIT $from, $limit";
3483
        }
3484
3485
        $result = Database::query($sql);
3486
        $num_rows = Database::num_rows($result);

main/inc/lib/usergroup.lib.php 1 location

@@ 1921-1925 (lines=5) @@
1918
        }
1919
1920
        $limit_text = '';
1921
        if (isset($from) && isset($limit)) {
1922
            $from = intval($from);
1923
            $limit = intval($limit);
1924
            $limit_text = "LIMIT $from, $limit";
1925
        }
1926
1927
        if (count($relation_type) == 0) {
1928
            $where_relation_condition = '';

main/inc/lib/course.lib.php 2 locations

@@ 3330-3334 (lines=5) @@
3327
                    $whereConditions
3328
                $orderBy
3329
                ";
3330
        if (isset($from) && isset($limit)) {
3331
            $from = intval($from);
3332
            $limit = intval($limit);
3333
            $sql .= " LIMIT $from, $limit";
3334
        }
3335
3336
        $result = Database::query($sql);
3337
@@ 6150-6155 (lines=6) @@
6147
6148
        $sql .= $order;
6149
6150
        if (isset($start) && isset($maxPerPage)) {
6151
            $start = intval($start);
6152
            $maxPerPage = intval($maxPerPage);
6153
            $limitCondition = " LIMIT $start, $maxPerPage";
6154
            $sql .= $limitCondition;
6155
        }
6156
6157
        if ($getCount) {
6158
            $result = Database::query($sql);