<commit_before><?php

namespace Peyote;

/**
 * A class for LIMIT statements.
 *
 * @package    Peyote
 * @author     <NAME> <<EMAIL>>
 */
class Limit implements \Peyote\Builder
{
	/**
	 * @var int  The limit count
	 */
	private $limit = null;

	/**
	 * Sets for the limit number.
	 *
	 * @param  int $num  The limit number
	 * @return $this
	 */
	public function limit($num = null)
	{
		$this->limit = (int) $num;
		return $this;
	}

	/**
	 * Compiles the query into raw SQL
	 *
	 * @return  string
	 */
	public function compile()
	{
		return ($this->limit === null) ? "" : "LIMIT {$this->limit}";
	}
}<commit_msg>Adding offset into the limit class for selecting rows.<commit_after><?php

namespace Peyote;

/**
 * A class for LIMIT statements.
 *
 * @package    Peyote
 * @author     <NAME> <<EMAIL>>
 */
class Limit implements \Peyote\Builder
{
	/**
	 * @var int  The limit count
	 */
	private $limit = null;

	/**
	 * @var int  The select offset
	 */
	private $offset = null;

	/**
	 * Sets for the limit number.
	 *
	 * @param  int $num  The limit number
	 * @return $this
	 */
	public function limit($num = null)
	{
		$this->limit = (int) $num;
		return $this;
	}

	/**
	 * Row offset (used only when selecting rows)
	 *
	 * @param  int $index  The row index to start the offset
	 * @return $this
	 */
	public function offset($index = null)
	{
		$this->offset = (int) $index;
		return $this;
	}

	/**
	 * Compiles the query into raw SQL
	 *
	 * @return  string
	 */
	public function compile()
	{
		if ($this->limit === null)
		{
			return "";
		}

		$sql = array("LIMIT");
		$sql[] = $this->limit;

		if ($this->offset !== null)
		{
			$sql[] = "OFFSET";
			$sql[] = $this->offset;
		}

		return implode(" ", $sql);
	}
}
{'fraction_non_alphanumeric': 0.1645422943221321, 'fraction_numerical': 0.0, 'mean_word_length': 2.5904365904365902, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2725225', 'n_tokens_mistral': 654, 'n_tokens_neox': 595, 'n_words': 183}