title: How to count the number of user downloads
body: <p>This code for extract files dir and title.  The user download when clicked the file link.  I need to count then number of downloads.  How to do this with cakephp or php?</p>
  
  <p>downloads_controller.php:</p>
  
  <pre><code>function index() {
      $this-&gt;set('downloads', $this-&gt;paginate());
  }
  </code></pre>
  
  <p>downloads/index.ctp:</p>
  
  <pre><code>&lt;?php
      $title = $download['Download']['title']; 
      // output filetitle 
      $filename = '/files/'.$download['Download']['filename']; 
      // output http://localhost/tet/files/un5titled0.rar
      echo $this-&gt;Html-&gt;link($title, $filename,array('escape' =&gt; false)); 
  ?&gt;
  </code></pre>