<commit_before><?php

trait Trait_currentMember
{
	protected $_current_member	=	null;

	protected function _checkCurrentMember()
	{
		if(isset($_SESSION['connected_user_id']))
			$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
		else
			$this->_current_member = new Model_Users();

		\Eliya\Tpl::set(['current_member' => $this->_current_member]);

		if(!isset($_SESSION['token_logout']))
			$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
	}

	protected function _redirectToCurrentMemberProfile()
	{
		$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
		exit;
	}
}<commit_msg>Fix user connection when session ID refers to deleted member<commit_after><?php

trait Trait_currentMember
{
	protected $_current_member	=	null;

	protected function _checkCurrentMember()
	{
		if(isset($_SESSION['connected_user_id']))
			$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
		else
			$this->_current_member = new Model_Users();

		if(empty($this->_current_member))
			$this->_current_member = new Model_Users();

		\Eliya\Tpl::set(['current_member' => $this->_current_member]);

		if(!isset($_SESSION['token_logout']))
			$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
	}

	protected function _redirectToCurrentMemberProfile()
	{
		$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
		exit;
	}
}
{'fraction_non_alphanumeric': 0.16152330925804334, 'fraction_numerical': 0.0, 'mean_word_length': 6.434146341463415, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '4994266', 'n_tokens_mistral': 510, 'n_tokens_neox': 480, 'n_words': 77}