add page number in overleaf
documentclass{article}
usepackage{lastpage}
usepackage{fancyhdr}
fancyfoot[C]{Page thepage of pageref{LastPage}}
% Uncomment to remove the header rule
% renewcommand{headrulewidth}{0pt}
pagestyle{fancy}
begin{document}
some dummy text
end{document}