def get_valid_step(current_step: int, max_step: int) -> int:
    """
    Checks if the current step is within boundaries and returns a corrected step.

    :param current_step: The current step to check.
    :param max_step: The maximum allowed step.
    :return: A corrected step between 1 and the maximum step.
    """
    if current_step < 1:
        current_step = 1
    elif current_step > max_step:
        current_step = max_step
    return current_step