original_string: public static function getDateRangeAndLastN($period, $endDate, $defaultLastN = null)
      {
          if ($defaultLastN === null) {
              $defaultLastN = self::getDefaultLastN($period);
          }
  
          $lastNParamName = self::getLastNParamName($period);
          $lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int');
  
          $site = new Site(Common::getRequestVar('idSite'));
  
          $dateRange = Range::getRelativeToEndDate($period, 'last' . $lastN, $endDate, $site);
  
          return array($dateRange, $lastN);
      }
code: public static function getDateRangeAndLastN($period, $endDate, $defaultLastN = null)
      {
          if ($defaultLastN === null) {
              $defaultLastN = self::getDefaultLastN($period);
          }
  
          $lastNParamName = self::getLastNParamName($period);
          $lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int');
  
          $site = new Site(Common::getRequestVar('idSite'));
  
          $dateRange = Range::getRelativeToEndDate($period, 'last' . $lastN, $endDate, $site);
  
          return array($dateRange, $lastN);
      }
code_tokens: public static function getDateRangeAndLastN ( $ period , $ endDate , $ defaultLastN = null ) { if ( $ defaultLastN === null ) { $ defaultLastN = self :: getDefaultLastN ( $ period ) ; } $ lastNParamName = self :: getLastNParamName ( $ period ) ; $ lastN = Common :: getRequestVar ( $ lastNParamName , $ defaultLastN , 'int' ) ; $ site = new Site ( Common :: getRequestVar ( 'idSite' ) ) ; $ dateRange = Range :: getRelativeToEndDate ( $ period , 'last' . $ lastN , $ endDate , $ site ) ; return array ( $ dateRange , $ lastN ) ; }
docstring: Returns the entire date range and lastN value for the current request, based on
  a period type and end date.
  
  @param string $period The period type, 'day', 'week', 'month' or 'year'
  @param string $endDate The end date.
  @param int|null $defaultLastN The default lastN to use. If null, the result of
  getDefaultLastN is used.
  @return array An array w/ two elements. The first is a whole date range and the second
  is the lastN number used, ie, array('2010-01-01,2012-01-02', 2).
docstring_tokens: Returns the entire date range and lastN value for the current request based on a period type and end date .