\documentclass{article}
\usepackage{lipsum}

\usepackage{titlesec}
\usepackage[pdfpagelabels=false]{hyperref}
\hypersetup{pageanchor=false}

\makeatletter
\newcounter{foobar}
\def\@oddfoot{\refstepcounter{foobar}\hss}

\setcounter{secnumdepth}{0}% important

\begin{document}
\section{A}\lipsum[1]
\section{B}\lipsum[2]
\section{C}\lipsum[3]

\newcommand\sectionbreak{\penalty-10000}% to call \output routine

\section{D}\lipsum[4]

\newpage
\tableofcontents
\end{document}
