";
devi@23: 			$last_tty=$cl->{"tty"};
devi@23: 		}
devi@23: 
devi@23: 		# TIME
devi@23: 		if ($Config{"show_time"} =~ /^y/i) {
devi@23: 			$Result{"body"} .= "| ";
devi@23: 		} else {
devi@23: 			$Result{"body"} .= "".
devi@23: 				$hour. ":". $min. ":". $sec.
devi@23: 				" | "
devi@23: 		}
devi@23: 
devi@23: 		# COMMAND
devi@23: 		$Result{"body"} .= " | \n";
devi@23: 		$Result{"body"} .= " \n";
devi@31: 		my $cline = $cl->{"prompt"}.$cl->{"cline"};
devi@23: 		$cline =~ s/\n//;
devi@32: 
devi@32: 		#$cline .= "(".$Sessions{$cl->{local_session_id}}.")";
devi@32: 		
devi@31: 		my $hint = make_comment($cl->{"cline"});
devi@31: 		$cline = "\n";
devi@23: 
devi@23: 		my $last_command = $cl->{"last_command"};
devi@23: 		if (!( 
devi@23: 		$Config{"suppress_editors"} =~ /^y/i && grep ($_ eq $last_command, @{$Config{"editors"}}) ||
devi@23: 		$Config{"suppress_pagers"}  =~ /^y/i && grep ($_ eq $last_command, @{$Config{"pagers"}}) ||
devi@23: 		$Config{"suppress_terminal"}=~ /^y/i && grep ($_ eq $last_command, @{$Config{"terminal"}})
devi@23: 			)) {
devi@23: 
devi@23: 			$Result{"body"} .= "$cline" if $hint;
devi@31: 		$Result{"body"} .= $cline;
devi@23: 		$Result{"body"} .= "";
devi@23: 			$Result{"body"} .= $output;
devi@23: 			$Result{"body"} .= "\n";
devi@23: 		}	
devi@23: 
devi@23: 		# DIFF
devi@23: 		if ( $Config{"show_diffs"} =~ /^y/i && $cl->{"diff"}) {
devi@23: 			$Result{"body"} .= "";
devi@23: 		}
devi@31: 		
devi@31: 		#NOTES
devi@31: 		if ( $Config{"show_notes"} =~ /^y/i && $cl->{"note"}) {
devi@31: 			my $note=$cl->{"note"};
devi@31: 			$note =~ s/\n/|  | ";
devi@23: 			$Result{"body"} .= $cl->{"diff"};
devi@23: 			$Result{"body"} .= " | 
 \n/msg;
devi@35: 			$note =~ s@(http:[a-zA-Z.0-9/?%-]*)@$1@g;
devi@35: 			$note =~ s@(www\.[a-zA-Z.0-9/?%-]*)@$1@g;
devi@31: 		#	Ширину пока не используем
devi@31: 		#	$Result{"body"} .= "
 ";
devi@31: 			$Result{"body"} .= "\n";
devi@23: 
devi@31: 	#$Result{"stat"} = "";
devi@31: 			$Result{"body"} .= "\n";
devi@31: 		}
devi@23: 
devi@23: 		# COMMENT
devi@23: 		if ( $Config{"show_comments"} =~ /^y/i) {
devi@31: 			my $comment = make_comment($cl->{"cline"});
devi@23: 			if ($comment) {
devi@23: 				$Result{"body"} .= "" if $cl->{note_title};
devi@31: 			$Result{"body"} .= "| ".$cl->{note_title}." |  ";
devi@31: 			$Result{"body"} .= "| ".$note." |  ".
devi@23: 						"";
devi@23: 			}
devi@23: 		}
devi@23: 
devi@23: 		# Вывод очередной команды окончен
devi@23: 		$Result{"body"} .= "\n";
devi@23: 		$Result{"body"} .= "\n";
devi@23: 	}
devi@23: 
devi@23: 	$Result{"body"} .= "|  | ";
devi@23: 				$Result{"body"} .= " ";
devi@23: 				$Result{"body"} .= $comment;
devi@23: 				$Result{"body"} .= "\n";
devi@23: 				$Result{"body"} .= " |  ";
devi@31: 
devi@31: 	%StatNames = (
devi@31: 		FirstCommand => "Время первой команды журнала",
devi@31: 		LastCommand => "Время последней команды журнала",
devi@31: 		TotalCommands => "Количество командных строк в журнале",
devi@32: 		ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
devi@31: 		TotalTime => "Суммарное время работы с терминалом *, час",
devi@31: 		CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
devi@37: 		CommandsFrequency => "Частота использования команд",
devi@31: 		RareCommands	=> "Частота использования этих команд < 0.5%",
devi@31: 	);
devi@31: 	@StatOrder = (
devi@31: 		FirstCommand,
devi@31: 		LastCommand,
devi@31: 		TotalCommands,
devi@31: 		ErrorsPercentage,
devi@31: 		TotalTime,
devi@31: 		CommandsPerTime,
devi@37: 		CommandsFrequency,
devi@31: 		RareCommands,
devi@31: 	);
devi@31: 
devi@31: 	# Подготовка статистики к выводу
devi@31: 	# Некоторые значения пересчитываются!
devi@31: 	# Дальше их лучше уже не использовать!!!
devi@31: 
devi@37: 	my %CommandsFrequency = %CommandsFDistribution;
devi@37: 
devi@31: 	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand});
devi@31: 	$Stat{FirstCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec,  $year+1900, $mon+1, $mday;
devi@31: 	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{LastCommand});
devi@31: 	$Stat{LastCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec,  $year+1900, $mon+1, $mday;
devi@31: 	$Stat{ErrorsPercentage} = sprintf "%5.2f", $Stat{ErrorCommands}*100/$Stat{TotalCommands}	
devi@31: 		if $Stat{TotalCommands};
devi@31: 	$Stat{CommandsPerTime} = sprintf "%5.2f", $Stat{TotalCommands}*60/$Stat{TotalTime}
devi@31: 		if $Stat{TotalTime};
devi@32: 	$Stat{TotalTime} = sprintf "%5.2f", $Stat{TotalTime}/60/60;
devi@31: 
devi@31: 	my $total_commands=0;
devi@37: 	for $command (keys %CommandsFrequency){
devi@37: 		$total_commands += $CommandsFrequency{$command};
devi@31: 	}
devi@31: 	if ($total_commands) {
devi@37: 		for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){
devi@32: 			my $command_html;
devi@37: 			my $percentage = sprintf "%5.2f",$CommandsFrequency{$command}*100/$total_commands;
devi@31: 			if ($percentage < 0.5) {
devi@31: 				my $hint = make_comment($command);
devi@32: 				$command_html = "$command";
devi@31: 				$command_html = "$command_html" if $hint;
devi@31: 				my $command_html = "$command_html";
devi@37: 				$Stat{RareCommands} .= $command_html."".$CommandsFrequency{$command}." , ";
devi@31: 			}
devi@31: 			else {
devi@31: 				my $hint = make_comment($command);
devi@32: 				$command_html = "$command";
devi@31: 				$command_html = "$command_html" if $hint;
devi@31: 				my $command_html = "$command_html";
devi@31: 				$percentage = sprintf "%5.2f",$percentage;
devi@37: 				$Stat{CommandsFrequency} .= "
 |