/**
 * Returns the html content for the query statistics
 *
 * @param PMA_ServerStatusData $ServerStatusData Server status data
 *
 * @return string
 */
function PMA_getHtmlForQueryStatistics($ServerStatusData)
{
    $retval = '';
    $hour_factor = 3600 / $ServerStatusData->status['Uptime'];
    $used_queries = $ServerStatusData->used_queries;
    $total_queries = array_sum($used_queries);
    $retval .= '<h3 id="serverstatusqueries">';
    /* l10n: Questions is the name of a MySQL Status variable */
    $retval .= sprintf(__('Questions since startup: %s'), PMA_Util::formatNumber($total_queries, 0));
    $retval .= ' ';
    $retval .= PMA_Util::showMySQLDocu('server-status-variables', false, 'statvar_Questions');
    $retval .= '<br />';
    $retval .= '<span>';
    $retval .= '&oslash; ' . __('per hour:') . ' ';
    $retval .= PMA_Util::formatNumber($total_queries * $hour_factor, 0);
    $retval .= '<br />';
    $retval .= '&oslash; ' . __('per minute:') . ' ';
    $retval .= PMA_Util::formatNumber($total_queries * 60 / $ServerStatusData->status['Uptime'], 0);
    $retval .= '<br />';
    if ($total_queries / $ServerStatusData->status['Uptime'] >= 1) {
        $retval .= '&oslash; ' . __('per second:') . ' ';
        $retval .= PMA_Util::formatNumber($total_queries / $ServerStatusData->status['Uptime'], 0);
    }
    $retval .= '</span>';
    $retval .= '</h3>';
    $retval .= PMA_getHtmlForServerStatusQueriesDetails($ServerStatusData);
    return $retval;
}
 /**
  * Test for PMA_getHtmlForServerStatusQueriesDetails
  *
  * @return void
  */
 public function testPMAGetHtmlForServerStatusQueriesDetails()
 {
     //Call the test function
     $html = PMA_getHtmlForServerStatusQueriesDetails($this->ServerStatusData);
     $hour_factor = 3600 / $this->ServerStatusData->status['Uptime'];
     $used_queries = $this->ServerStatusData->used_queries;
     $total_queries = array_sum($used_queries);
     //validate 1: PMA_getHtmlForServerStatusQueriesDetails
     $this->assertContains(__('Statements'), $html);
     //validate 2: used queries
     $this->assertContains(htmlspecialchars("change db"), $html);
     $this->assertContains('54', $html);
     $this->assertContains(htmlspecialchars("select"), $html);
     $this->assertContains(htmlspecialchars("set option"), $html);
     $this->assertContains(htmlspecialchars("show databases"), $html);
     $this->assertContains(htmlspecialchars("show status"), $html);
     $this->assertContains(htmlspecialchars("show tables"), $html);
     //validate 3:serverstatusquerieschart
     $this->assertContains('<div id="serverstatusquerieschart"></div>', $html);
     $this->assertContains('<div id="serverstatusquerieschart_data"', $html);
 }
 /**
  * Test for PMA_getHtmlForServerStatusQueriesDetails
  *
  * @return void
  */
 public function testPMAGetHtmlForServerStatusQueriesDetails()
 {
     //Call the test function
     $html = PMA_getHtmlForServerStatusQueriesDetails($this->ServerStatusData);
     //validate 1: PMA_getHtmlForServerStatusQueriesDetails
     $this->assertContains(__('Statements'), $html);
     //validate 2: used queries
     $this->assertContains(htmlspecialchars("change db"), $html);
     $this->assertContains('54', $html);
     $this->assertContains(htmlspecialchars("select"), $html);
     $this->assertContains(htmlspecialchars("set option"), $html);
     $this->assertContains(htmlspecialchars("show databases"), $html);
     $this->assertContains(htmlspecialchars("show status"), $html);
     $this->assertContains(htmlspecialchars("show tables"), $html);
     //validate 3:serverstatusquerieschart
     $this->assertContains('<div id="serverstatusquerieschart"></div>', $html);
     $this->assertContains('<div id="serverstatusquerieschart_data"', $html);
 }