Code Duplication    Length = 5-6 lines in 6 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/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/sessionmanager.lib.php 1 location

@@ 3501-3505 (lines=5) @@
3498
            return $row['count'];
3499
        }
3500
3501
        if (isset($from) && isset($limit)) {
3502
            $from = intval($from);
3503
            $limit = intval($limit);
3504
            $sql .= " LIMIT $from, $limit";
3505
        }
3506
3507
        $result = Database::query($sql);
3508
        $num_rows = Database::num_rows($result);

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

@@ 3326-3330 (lines=5) @@
3323
                    $whereConditions
3324
                $orderBy
3325
                ";
3326
        if (isset($from) && isset($limit)) {
3327
            $from = intval($from);
3328
            $limit = intval($limit);
3329
            $sql .= " LIMIT $from, $limit";
3330
        }
3331
3332
        $result = Database::query($sql);
3333
@@ 6214-6219 (lines=6) @@
6211
6212
        $sql .= $order;
6213
6214
        if (isset($start) && isset($maxPerPage)) {
6215
            $start = intval($start);
6216
            $maxPerPage = intval($maxPerPage);
6217
            $limitCondition = " LIMIT $start, $maxPerPage";
6218
            $sql .= $limitCondition;
6219
        }
6220
6221
        if ($getCount) {
6222
            $result = Database::query($sql);

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

@@ 5841-5846 (lines=6) @@
5838
5839
        $sql .= $order;
5840
5841
        if (isset($start) && isset($maxPerPage)) {
5842
            $start = intval($start);
5843
            $maxPerPage = intval($maxPerPage);
5844
            $limitCondition = " LIMIT $start, $maxPerPage";
5845
            $sql .= $limitCondition;
5846
        }
5847
5848
        $result = Database::query($sql);
5849
        $sessionsCategories = array();