<commit_before><?php

/**
 * Find and retrieve information about recently posted topics, messages, and the like.
 *
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0 Beta 2
 *
 */

if (!defined('ELK'))
	die('No access...');

/**
 * Unread posts and replies Controller
 */
class Unread_Class
{
	const UNREAD = 0;
	const UNREADREPLIES = 1;

	private $_have_temp_table = false;

	private $_ascending = false;

	private $_sort_query = '';

	private $_num_topics = 0;

	private $_min_message = 0;

	private $_action = self::UNREAD;

	private $_earliest_msg = 0;

	private $_showing_all_topics = false;

	private $_user_id = 0;

	private $_post_mod = false;

	private $_unwatch = false;

	private $_db = null;

	private $_preview_bodies = 0;

	/**
	 * Parameters for the main query.
	 */
	private $_query_parameters = array();

	/**
	 * Constructor
	 *
	 * @param int $user - ID of the user
	 * @param bool|int $post_mod - if post moderation is active or not
	 * @param bool|int $unwatch - if unwatch topics is active or not
	 * @param bool $showing_all_topics - Is the user looking at all the unread
	 *             replies, or the recent topics?
	 */
	public function __construct($user, $post_mod, $unwatch, $showing_all_topics = false)
	{
		$this->_user_id = (int) $user;
		$this->_post_mod = (bool) $post_mod;
		$this->_unwatch = (bool) $unwatch;
		$this->_showing_all_topics = (bool) $showing_all_topics;

		$this->_db = database();
	}

	/**
	 * Sets the boards the member is looking at
	 *
	 * @param int|int[] $boards - the id of the boards
	 */
	public function setBoards($boards)
	{
		if (is_array($boards))
			$this->_query_parameters['boards'] = $boards;
		else
			$this->_query_parameters['boards'] = array($boards);
	}

	/**
	 * The action the user is performing
	 *<commit_msg>Wrong doc<commit_after><?php

/**
 * Find and retrieve information about recently posted topics, messages, and the like.
 *
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0 Beta 2
 *
 */

if (!defined('ELK'))
	die('No access...');

/**
 * Unread posts and replies Controller
 */
class Unread_Class
{
	const UNREAD = 0;
	const UNREADREPLIES = 1;

	private $_have_temp_table = false;

	private $_ascending = false;

	private $_sort_query = '';

	private $_num_topics = 0;

	private $_min_message = 0;

	private $_action = self::UNREAD;

	private $_earliest_msg = 0;

	private $_showing_all_topics = false;

	private $_user_id = 0;

	private $_post_mod = false;

	private $_unwatch = false;

	private $_db = null;

	private $_preview_bodies = 0;

	/**
	 * Parameters for the main query.
	 */
	private $_query_parameters = array();

	/**
	 * Constructor
	 *
	 * @param int $user - ID of the user
	 * @param bool|int $post_mod - if post moderation is active or not
	 * @param bool|int $unwatch - if unwatch topics is active or not
	 * @param bool|int $showing_all_topics - Is the user looking at all the unread
	 *             replies, or the recent topics?
	 */
	public function __construct($user, $post_mod, $unwatch, $showing_all_topics = false)
	{
		$this->_user_id = (int) $user;
		$this->_post_mod = (bool) $post_mod;
		$this->_unwatch = (bool) $unwatch;
		$this->_showing_all_topics = (bool) $showing_all_topics;

		$this->_db = database();
	}

	/**
	 * Sets the boards the member is looking at
	 *
	 * @param int|int[] $boards - the id of the boards
	 */
	public function setBoards($boards)
	{
		if (is_array($boards))
			$this->_query_parameters['boards'] = $boards;
		else
			$this->_query_parameters['boards'] = array($boards);
	}

	/**
	 * The action the user is performing
	 *
{'fraction_non_alphanumeric': 0.1269577598481253, 'fraction_numerical': 0.007119126720455624, 'mean_word_length': 3.522532188841202, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5911942', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1376, 'n_words': 427}