<commit_before><?php
/**
 * @file src/Module/Logout.php
 */

namespace Friendica\Module;

use Friendica\BaseModule;
use Friendica\Core\Authentication;
use Friendica\Core\Hook;
use Friendica\Core\L10n;

/**
 * Logout module
 *
 * @author <NAME> <<EMAIL>>
 */
class Logout extends BaseModule
{
	/**
	 * @brief Process logout requests
	 */
	public static function init()
	{
		Hook::callAll("logging_out");
		Authentication::deleteSession();
		info(L10n::t('Logged out.') . EOL);
		self::getApp()->internalRedirect();
	}
}<commit_msg>Redirect remote visitors to their own profile after logout<commit_after><?php
/**
 * @file src/Module/Logout.php
 */

namespace Friendica\Module;

use Friendica\BaseModule;
use Friendica\Core\Authentication;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Model\Profile;

/**
 * Logout module
 *
 * @author <NAME> <<EMAIL>>
 */
class Logout extends BaseModule
{
	/**
	 * @brief Process logout requests
	 */
	public static function init()
	{
		$visitor_home = null;
		if (remote_user()) {
			$visitor_home = Profile::getMyURL();
		}

		Hook::callAll("logging_out");
		Authentication::deleteSession();

		if ($visitor_home) {
			System::externalRedirect($visitor_home);
		} else {
			info(L10n::t('Logged out.'));
			self::getApp()->internalRedirect();
		}
	}
}
{'fraction_non_alphanumeric': 0.15765765765765766, 'fraction_numerical': 0.006006006006006006, 'mean_word_length': 4.41869918699187, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6680020', 'n_tokens_mistral': 476, 'n_tokens_neox': 446, 'n_words': 93}