diff --git a/web/application/models/histories.php b/web/application/models/histories.php index db54d4f..c4b3c55 100644 --- a/web/application/models/histories.php +++ b/web/application/models/histories.php @@ -21,4 +21,22 @@ class Histories extends \system\engine\HF_Model { return "danger"; } } + + private function formatBytes($bytes, $precision = 2) { + $units = array('B', 'KB', 'MB', 'GB', 'TB'); + + $bytes = max($bytes, 0); + $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); + $pow = min($pow, count($units) - 1); + + // Uncomment one of the following alternatives + // $bytes /= pow(1024, $pow); + // $bytes /= (1 << (10 * $pow)); + + return round($bytes, $precision) . ' ' . $units[$pow]; + } + +public function getSize() { + return $this->formatBytes(strlen($this->output)); + } } \ No newline at end of file diff --git a/web/application/views/history.html b/web/application/views/history.html index 114db88..3f5a034 100644 --- a/web/application/views/history.html +++ b/web/application/views/history.html @@ -38,6 +38,7 @@