Let $X_1, X_2,\cdots$ be an i.i.d. sequence with $EX_1 = \mu > 0, \operatorname{var}(X_1) = \sigma^2 > 0, E \exp(sX_1) < \infty, |s| < s_1$, and partial sums $S_0 = 0, S_n = X_1 + \cdots + X_n$. For $t \geq 0$, put $N(t) = \max \{n \geq 0: S_0,\ldots, S_n \leq t\}$, i.e., $L(t) = N(t) + 1$ denotes the first-passage time of the random walk $\{S_n\}$. Starting from some analogous results for the partial sum sequence, this paper studies the almost sure limiting behaviour of $\sup_{0 \leq t \leq T - K_T} (N(t + K_T) - N(t))$ as $T \rightarrow \infty$, under various conditions on the real function $K_T$. Improvements of the Erdos-Renyi strong law for renewal processes (resp. first-passage times) are obtained as well as strong invariance principle type versions. An indefinite range between strong invariance and strong noninvariance is also treated.