<commit_before>package Demo::InFilter::Default;
use DBIx::Struct;
use Demo::Common;
use PEF::Front::Session;
use Digest::MD5 qw(md5_hex);
use Data::Dumper;
use PEF::Front::Config;
use strict;
use warnings;

sub auth_to_author {
	my ($field, $def) = @_;
	my $is_author = 0;
print STDERR "*** auth_to_author *** | enter\n";
	if ($def->{request}->cookies->{auth}) {
print STDERR "*** auth_to_author *** | auth\n";
print STDERR Dumper $def->{request}, $def->{request}->param(cfg_session_request_field());
		my $session = PEF::Front::Session->new($def->{request});
print STDERR Dumper $session, $session->data, $session->data->{name};
		if (%{$session->data} && $session->data->{name}) {
print STDERR "*** auth_to_author *** | session\n";
			$field     = $session->data->{name};
			$is_author = $session->data->{is_author};
			print STDERR Dumper $session->data, $session->data->{is_oauth};
			if ($session->data->{is_oauth}) {
				$field = "anonymous-" . substr (md5_hex($field), 0, 4);
			}
		} else {
			my $author = get_author_from_auth($def->{request}->cookies->{auth});
			if ($author) {
				$field     = $author->name;
				$is_author = 1;
			}
		}
	}
	if (!$is_author) {
		$field =~ s/^\s*//;
		$field =~ s/\s*$//;<commit_msg>removed debug<commit_after>package Demo::InFilter::Default;
use DBIx::Struct;
use Demo::Common;
use PEF::Front::Session;
use Digest::MD5 qw(md5_hex);
use strict;
use warnings;

sub auth_to_author {
	my ($field, $def) = @_;
	my $is_author = 0;
	if ($def->{request}->cookies->{auth}) {
		my $session = PEF::Front::Session->new($def->{request});
		if (%{$session->data} && $session->data->{name}) {
			$field     = $session->data->{name};
			$is_author = $session->data->{is_author};
			if ($session->data->{is_oauth}) {
				$field = "anonymous-" . substr (md5_hex($field), 0, 4);
			}
		} else {
			my $author = get_author_from_auth($def->{request}->cookies->{auth});
			if ($author) {
				$field     = $author->name;
				$is_author = 1;
			}
		}
	}
	if (!$is_author) {
		$field =~ s/^\s*//;
		$field =~ s/\s*$//;
{'fraction_non_alphanumeric': 0.22805296714075526, 'fraction_numerical': 0.006866110838646395, 'mean_word_length': 4.1, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 48, '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': '2460792', 'n_tokens_mistral': 869, 'n_tokens_neox': 800, 'n_words': 150}