original_string: public static function calculateOffset($count, $limit, $comment = null) {
  
  		$order = self::getCommentsSort();
  		$style = self::getLoadStyle();
  
  		if ($comment instanceof Comment) {
  			$thread = new Thread($comment);
  			$offset = $thread->getOffset($limit, $order);
  		} else if (($order == 'time_created::asc' && $style == 'load_older') || ($order == 'time_created::desc' && $style == 'load_newer')) {
  			// show last page
  			$offset = $count - $limit;
  			if ($offset < 0) {
  				$offset = 0;
  			}
  		} else {
  			// show first page
  			$offset = 0;
  		}
  
  		return (int) $offset;
  	}
code: public static function calculateOffset($count, $limit, $comment = null) {
  
  		$order = self::getCommentsSort();
  		$style = self::getLoadStyle();
  
  		if ($comment instanceof Comment) {
  			$thread = new Thread($comment);
  			$offset = $thread->getOffset($limit, $order);
  		} else if (($order == 'time_created::asc' && $style == 'load_older') || ($order == 'time_created::desc' && $style == 'load_newer')) {
  			// show last page
  			$offset = $count - $limit;
  			if ($offset < 0) {
  				$offset = 0;
  			}
  		} else {
  			// show first page
  			$offset = 0;
  		}
  
  		return (int) $offset;
  	}
code_tokens: public static function calculateOffset ( $ count , $ limit , $ comment = null ) { $ order = self :: getCommentsSort ( ) ; $ style = self :: getLoadStyle ( ) ; if ( $ comment instanceof Comment ) { $ thread = new Thread ( $ comment ) ; $ offset = $ thread -> getOffset ( $ limit , $ order ) ; } else if ( ( $ order == 'time_created::asc' && $ style == 'load_older' ) || ( $ order == 'time_created::desc' && $ style == 'load_newer' ) ) { // show last page $ offset = $ count - $ limit ; if ( $ offset < 0 ) { $ offset = 0 ; } } else { // show first page $ offset = 0 ; } return ( int ) $ offset ; }
docstring: Calculate offset till the page that contains the comment
  
  @param int     $count   Number of comments in the list
  @param int     $limit   Number of comments to display
  @param Comment $comment Comment entity
  @return int
docstring_tokens: Calculate offset till the page that contains the comment