<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Team extends Application {

	function __construct()
    {
        parent::__construct();
    }

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		$this->data['pagebody'] = 'Team';
		$this->load->model('roster');
		$this->data["roster"] = $this->roster->paginate(1);
		$pages = ceil($this->roster->size() / 12);
		$this->data['pages'] = $this->buildPagination($pages);
		$this->data['showLeft'] = "disabled";
		$this->data['showRight'] = $pages == 1 ? "disabled" : "";
		$this->data['previousPage'] = "";
		$this->data['nextPage'] = "/team/page/" + 2;
		$this->data['pageNum'] = 1;
		$this->render();
	}
	public function page($page, $mode = null)
	{
		//echo $_SESSION['teamMode'];
		echo isset($mode);
		if(isset($mode)) {
			$this->session->set_userdata('teamMode', $mode);
		} else if(!isset($_SESSION['teamMode'])){
			$this->session->set_userdata('teamMode', "team");
		} 
		//echo $_SESSION['teamMode'];
		$this->data['pagebody'] = $_SESSION['teamMode'];
		$this->load->model('roster');
		$this->data["roster"] = $this->roster->paginate($page);
		$pages = ceil($this->roster->size() / 12);
		$this->setPagination($pages, $page);
		$this->render();
	}
	private function buildPagination($pages) {
		$result = array();
		for($i = 0; $i < $pages; $i++) {
			$temp = array(
				"pageNum" => $i + 1
			);
			array_push($result, $temp);
		}
		return $result;
	}
	private function setPagination($pages, $page) {
		$this->data['pages'] = $this->buildPagination($pages);
		$this->data['showLeft'] = $page ==1 ? "disabled" : "";
		$this->data['showRight'] = $page >= $pages ? "disabled" : "";
		$this->data["previousPage"] = $page ==1 ? "" : "/team/page/"+$page - 1;
		$this->data['nextPage'] = $page >= $pages ? "" : "/team/page/"+$page+1;
	}
}
<commit_msg>Fixed js bug with sessions<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Team extends Application {

	function __construct()
    {
        parent::__construct();
    }

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		$this->data['pagebody'] = 'Team';	
		$this->load->model('roster');
		$this->data["roster"] = $this->roster->paginate(1);
		$pages = ceil($this->roster->size() / 12);
		$this->data['pages'] = $this->buildPagination($pages);
		$this->data['showLeft'] = "disabled";
		$this->data['showRight'] = $pages == 1 ? "disabled" : "";
		$this->data['previousPage'] = "";
		$this->data['nextPage'] = "/team/page/" + 2;
		$this->data['pageNum'] = 1;
		$this->render();
	}
	public function layout($page) {
		$this->session->set_userdata('teamMode', $page);
	}
	
	public function page($page, $mode = null)
	{	
		if (!isset($mode)) {
			$this->session->set_userdata('teamMode', 'team');
		} else {
			$this->session->set_userdata('teamMode', 'teamGallery');
		}
		
		//$this->session->set_userdata('teamMode', 'teamGallery');
		
		
		$this->data['pagebody'] = $_SESSION['teamMode'];
		$this->load->model('roster');
		$this->data["roster"] = $this->roster->paginate($page);
		$pages = ceil($this->roster->size() / 12);
		$this->setPagination($pages, $page);
		$this->render();
	}
	private function buildPagination($pages) {
		$result = array();
		for($i = 0; $i < $pages; $i++) {
			$temp = array(
				"pageNum" => $i + 1
			);
			array_push($result, $temp);
		}
		return $result;
	}
	private function setPagination($pages, $page) {
		$this->data['pages'] = $this->buildPagination($pages);
		$this->data['showLeft'] = $page ==1 ? "disabled" : "";
		$this->data['showRight'] = $page >= $pages ? "disabled" : "";
		$this->data["previousPage"] = $page ==1 ? "" : "/team/page/"+$page - 1;
		$this->data['nextPage'] = $page >= $pages ? "" : "/team/page/"+$page+1;
	}
}

{'fraction_non_alphanumeric': 0.22113544546034447, 'fraction_numerical': 0.005953646608547736, 'mean_word_length': 3.8147389969293757, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 87, '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': '3081147', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1643, 'n_words': 319}