[Tex/LaTex] Hyperref marks lastpage as a reference

fancyhdrhyperreflastpage

I am using the hyperref package, lastpage package and fancyhdr package. My problem is, that the number showing the amount of total pages (in the footer) is red and works like a link to the front page. I do not want it to be neither red or work as a link, though I want to link to the sections in my table of contents (which works perfectly).
Please help! 🙂

\documentclass[11pt, a4paper, oneside]{article}         
\usepackage{lastpage}
\usepackage{fancyhdr}
    \pagestyle{fancy}
        \fancyhead[LO,LE]{Author}
        \fancyhead[RO,RE]{Document title}
        \fancyfoot[CO, CE]{Page \thepage\ of \pageref{LastPage}}
\usepackage{hyperref}
\hypersetup{
    linktoc=section,
    colorlinks=true
}


\begin{document}


\thispagestyle{empty}

\vspace*{3cm}
\noindent \rule{\linewidth}{3pt}
\vspace{0.2cm}
\begin{center}\textbf{\Huge{Title}}\end{center}
\vspace{0.5cm}
\rule{\linewidth}{3pt}

\vspace{3cm}

\newpage


\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{arabic}

\section{First section} \label{sec:1}


\section{Second section}

This is a reference to \nameref{sec:1}.


\end{document}

Best Answer

The hyperref package provides the variant commands \ref* and \pageref* in case one needs to avoid the creation of a hyperlink while creating a cross-reference.

Thus, if you write

\fancyfoot[CO, CE]{Page \thepage\ of \pageref*{LastPage}

you'll achieve your objective.