\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[slovak,shorthands=off]{babel}
% \usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagenumbering{Alph}

\pagestyle{fancy}
\fancyfoot{222}
\fancyhead[LE,RO]{545}

\renewcommand{\headrulewidth}{5pt}



\begin{document}
\tableofcontents


\chapter[kratky nazov]{dlhy velmi dlhy nazov}


\lipsum{2-4}


\setcounter{page}{23}
\chapter[kratky nazov]{\lipsum{2-4}}

\lipsum{2-4}

\end{document}
