original_string: protected function normalise_limit_from_num($limitfrom, $limitnum) {
          global $CFG;
  
          // We explicilty treat these cases as 0.
          if ($limitfrom === null || $limitfrom === '' || $limitfrom === -1) {
              $limitfrom = 0;
          }
          if ($limitnum === null || $limitnum === '' || $limitnum === -1) {
              $limitnum = 0;
          }
  
          if ($CFG->debugdeveloper) {
              if (!is_numeric($limitfrom)) {
                  $strvalue = var_export($limitfrom, true);
                  debugging("Non-numeric limitfrom parameter detected: $strvalue, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              } else if ($limitfrom < 0) {
                  debugging("Negative limitfrom parameter detected: $limitfrom, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              }
  
              if (!is_numeric($limitnum)) {
                  $strvalue = var_export($limitnum, true);
                  debugging("Non-numeric limitnum parameter detected: $strvalue, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              } else if ($limitnum < 0) {
                  debugging("Negative limitnum parameter detected: $limitnum, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              }
          }
  
          $limitfrom = (int)$limitfrom;
          $limitnum  = (int)$limitnum;
          $limitfrom = max(0, $limitfrom);
          $limitnum  = max(0, $limitnum);
  
          return array($limitfrom, $limitnum);
      }
code: protected function normalise_limit_from_num($limitfrom, $limitnum) {
          global $CFG;
  
          // We explicilty treat these cases as 0.
          if ($limitfrom === null || $limitfrom === '' || $limitfrom === -1) {
              $limitfrom = 0;
          }
          if ($limitnum === null || $limitnum === '' || $limitnum === -1) {
              $limitnum = 0;
          }
  
          if ($CFG->debugdeveloper) {
              if (!is_numeric($limitfrom)) {
                  $strvalue = var_export($limitfrom, true);
                  debugging("Non-numeric limitfrom parameter detected: $strvalue, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              } else if ($limitfrom < 0) {
                  debugging("Negative limitfrom parameter detected: $limitfrom, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              }
  
              if (!is_numeric($limitnum)) {
                  $strvalue = var_export($limitnum, true);
                  debugging("Non-numeric limitnum parameter detected: $strvalue, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              } else if ($limitnum < 0) {
                  debugging("Negative limitnum parameter detected: $limitnum, did you pass the correct arguments?",
                      DEBUG_DEVELOPER);
              }
          }
  
          $limitfrom = (int)$limitfrom;
          $limitnum  = (int)$limitnum;
          $limitfrom = max(0, $limitfrom);
          $limitnum  = max(0, $limitnum);
  
          return array($limitfrom, $limitnum);
      }
code_tokens: protected function normalise_limit_from_num ( $ limitfrom , $ limitnum ) { global $ CFG ; // We explicilty treat these cases as 0. if ( $ limitfrom === null || $ limitfrom === '' || $ limitfrom === - 1 ) { $ limitfrom = 0 ; } if ( $ limitnum === null || $ limitnum === '' || $ limitnum === - 1 ) { $ limitnum = 0 ; } if ( $ CFG -> debugdeveloper ) { if ( ! is_numeric ( $ limitfrom ) ) { $ strvalue = var_export ( $ limitfrom , true ) ; debugging ( "Non-numeric limitfrom parameter detected: $strvalue, did you pass the correct arguments?" , DEBUG_DEVELOPER ) ; } else if ( $ limitfrom < 0 ) { debugging ( "Negative limitfrom parameter detected: $limitfrom, did you pass the correct arguments?" , DEBUG_DEVELOPER ) ; } if ( ! is_numeric ( $ limitnum ) ) { $ strvalue = var_export ( $ limitnum , true ) ; debugging ( "Non-numeric limitnum parameter detected: $strvalue, did you pass the correct arguments?" , DEBUG_DEVELOPER ) ; } else if ( $ limitnum < 0 ) { debugging ( "Negative limitnum parameter detected: $limitnum, did you pass the correct arguments?" , DEBUG_DEVELOPER ) ; } } $ limitfrom = ( int ) $ limitfrom ; $ limitnum = ( int ) $ limitnum ; $ limitfrom = max ( 0 , $ limitfrom ) ; $ limitnum = max ( 0 , $ limitnum ) ; return array ( $ limitfrom , $ limitnum ) ; }
docstring: Ensures that limit params are numeric and positive integers, to be passed to the database.
  We explicitly treat null, '' and -1 as 0 in order to provide compatibility with how limit
  values have been passed historically.
  
  @param int $limitfrom Where to start results from
  @param int $limitnum How many results to return
  @return array Normalised limit params in array($limitfrom, $limitnum)
docstring_tokens: Ensures that limit params are numeric and positive integers to be passed to the database . We explicitly treat null and - 1 as 0 in order to provide compatibility with how limit values have been passed historically .