title: CSS - How to count total number of pages?
body: <p>I'm trying to show the number of pages on PDF file.</p>
  
  <p>So in the header I put this css:</p>
  
  <pre><code>.page-number:after { 
    counter-increment: pages; 
    content: counter(page) " of " counter(pages); 
   }
  </code></pre>
  
  <p>Html:</p>
  
  <pre><code>&lt;span class="page-number"&gt;Page &lt;/span&gt;
  </code></pre>
  
  <p>But it returns me <code>Page 1 of 1</code> ... <code>Page 2 of 2</code>.
  The first counter works fine but the total is wrong.
  How can I solve that?</p>