my $lang;
# cookie
if ( $query->cookie('KohaOpacLanguage') ) {
if ( defined $query and $query->cookie('KohaOpacLanguage') ) {
$lang = $query->cookie('KohaOpacLanguage');
$lang =~ s/[^a-zA-Z_-]*//; # sanitize cookie
}
-