Fixed percentiles when max is specified

Records after the max value were being ignored in the calculation of
total records in the histogram, leading to an incorrect percentile
column. Fixes issue #4.