<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.0.9
  @date  05/09/10, 11:17
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
?>
<!-- body //-->
<h4><?php echo HEADING_TITLE; ?></h4>
<!-- body_text //-->
        <table style="width:100%" class="dataTable">
            <thead>
                <tr>
                        <th><?php echo TABLE_HEADING_NUMBER; ?></th>
                        <th><?php echo TABLE_HEADING_PRODUCTS; ?></th>
                        <th><?php echo TABLE_HEADING_VIEWED; ?></th>
                </tr>
            </thead>
            <tbody>
<?php
  if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
  $rows = 0;
  $products_query_raw = "select p.products_id, pd.products_name, pd.products_viewed, l.name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_LANGUAGES . " l where p.products_id = pd.products_id and l.languages_id = pd.language_id order by pd.products_viewed DESC";
  $db_query_split = new splitPageResults($_GET['page'], MAX_DISPLAY_ROW_BY_PAGE, $products_query_raw, $db_query_numrows);
  $products_query = tep_db_query($products_query_raw);
  while ($products = tep_db_fetch_array($products_query)) {
    $rows++;

    if (strlen($rows) < 2) {
      $rows = '0' . $rows;
    }
?>
                <tr class="dataTableRow" >
                        <td><?php echo $rows; ?>.</td>
        <td><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=new_product_preview&amp;read=only&amp;pID=' . $products['products_id'] . '&amp;origin=' . FILENAME_STATS.'?module='.$module_stats . '&amp;page=' . $_GET['page'], 'NONSSL') . '">' . $products['products_name'] . '</a> (' . $products['name'] . ')'; ?></td>
                        <td><?php echo $products['products_viewed']; ?></td>
                </tr>
<?php
  }
?>
    </tbody>
</table>
<!-- body_text_eof //-->
<!-- body_eof //-->