More flexibly trim off the history's entry number