<commit_before><?php


use models\ProjectListModel;
use models\FeaturedProjectListModel;

use models\rights\Operation;
use models\rights\Domain;
use models\rights\Realm;
use models\rights\Roles;


class Base extends CI_Controller {
	
	protected $_isLoggedIn;
	
	protected $_user;
	
	protected $_project;
	
	public function __construct() {
		parent::__construct();
		$this->load->library('ion_auth');
		$this->_isLoggedIn = $this->ion_auth->logged_in();
		if ($this->_isLoggedIn) {
			try {
				$userId = (string)$this->session->userdata('user_id');
				$this->_user = new \models\UserModel($userId);
			} catch (Exception $e) {
				error_log("User not found, logged out.\n" . $e->getMessage());
				$this->ion_auth->logout();
			}
		}
		$uriParts = explode('.', $_SERVER['HTTP_HOST']);
		if ($uriParts[0] == 'scriptureforge' || $uriParts[0] == 'dev' || $uriParts[0] == 'www') {
			$this->_project = 'scriptureforge';
		} else {
			$this->_project = $uriParts[0];
		}
		
	}
	
	// all child classes should use this method to render their pages
	protected function _render_page($view, $data=null, $render=true) {
		$this->renderProjectPage($view, '', $data, $render);
	}
	
	protected function renderProjectPage($view, $project = '', $data = null, $render = true) {
		$this->viewdata = (empty($data)) ? $this->data : $data;

		$project = $this->_project;
		
		if ($project == 'scriptureforge') {
			$containerView = 'templates/container.html.php';
		} else {
// 			$view = 'projects/' . $project . '/' . $view;
			$containerView = 'projects/' . $project . '/templates/container.html.php';
		}
		
		if (file_exists(self::templateToPath($view))) {
			$this->viewdata["page"] = $view . ".html.php";
		} else if (file_exists(self::templateToPath($view, '.php'))) {
			$this->viewdata["page"] = $view . ".php";<commit_msg>Fix handling of www domains.  Now shifts off the front of the array.<commit_after><?php


use models\ProjectListModel;
use models\FeaturedProjectListModel;

use models\rights\Operation;
use models\rights\Domain;
use models\rights\Realm;
use models\rights\Roles;


class Base extends CI_Controller {
	
	protected $_isLoggedIn;
	
	protected $_user;
	
	protected $_project;
	
	public function __construct() {
		parent::__construct();
		$this->load->library('ion_auth');
		$this->_isLoggedIn = $this->ion_auth->logged_in();
		if ($this->_isLoggedIn) {
			try {
				$userId = (string)$this->session->userdata('user_id');
				$this->_user = new \models\UserModel($userId);
			} catch (Exception $e) {
				error_log("User not found, logged out.\n" . $e->getMessage());
				$this->ion_auth->logout();
			}
		}
		$uriParts = explode('.', $_SERVER['HTTP_HOST']);
		if ($uriParts[0] == 'www') {
			array_shift($uriParts);
		}
		if ($uriParts[0] == 'scriptureforge' || $uriParts[0] == 'dev') {
			$this->_project = 'scriptureforge';
		} else {
			$this->_project = $uriParts[0];
		}
		
	}
	
	// all child classes should use this method to render their pages
	protected function _render_page($view, $data=null, $render=true) {
		$this->renderProjectPage($view, '', $data, $render);
	}
	
	protected function renderProjectPage($view, $project = '', $data = null, $render = true) {
		$this->viewdata = (empty($data)) ? $this->data : $data;

		$project = $this->_project;
		
		if ($project == 'scriptureforge') {
			$containerView = 'templates/container.html.php';
		} else {
// 			$view = 'projects/' . $project . '/' . $view;
			$containerView = 'projects/' . $project . '/templates/container.html.php';
		}
		
		if (file_exists(self::templateToPath($view))) {
			$this->viewdata["page"] = $view . ".html.php";
		} else if (file_exists(self::templateToPath($view, '.php'))) {
			$this->viewdata["page"] = $view . ".php";
{'fraction_non_alphanumeric': 0.1888111888111888, 'fraction_numerical': 0.002151694459386767, 'mean_word_length': 4.012129380053908, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, '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': '3067485', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1241, 'n_words': 257}