truncate the array, meaning cut off the trailing empty entries
truncate the array after the last valid entry and hence cut off the empty trailing empty entries